next-apollo icon indicating copy to clipboard operation
next-apollo copied to clipboard

Can not set server-side authentication headers

Open monokrome opened this issue 5 years ago • 3 comments

The following comment suggests that this is possible, but I've spent the better part of the last 3 hours trying every trick in the book and can't find any solutions. Is this supported? We can't monkey patch it since it's not exported, but that seems excessive anyway. What is the expected use-case that this comment refers to?

https://github.com/adamsoffer/next-apollo/blob/master/src/withApollo.js#L181-L182

Thanks a bunch =^.^=

monokrome avatar May 21 '20 11:05 monokrome

Thoughts? @adamsoffer

monokrome avatar May 27 '20 17:05 monokrome

hm that's odd. Sorry for the trouble. I'm not sure why the headers wouldn't be getting set. I'll look into this. Out of curiosity, if you use the with-apollo example in the next.js repo do the headers get set? This lib essentially just packages up and creates an abstraction based on that example.

adamsoffer avatar May 27 '20 17:05 adamsoffer

I also had the same issue. I used with-apollo in the next.js repo and I have noticed the same issue too. On client-side it works perfectly. if you want a demo you can visit https://dev.techdiary.dev. if you login and then go to Menu>dashboard and refresh the page it pass the headers every time but. But if you go to / page (which is server side) the cookie doesn't pass, hence it shows me as not logged in any more. If you find any solution please le me know. FYI, cookie sets everytime I log in but if I refresh the page it doesn't send cookie anymore but on the client side, it sends cookie everytime.

shoaibsharif avatar Jul 14 '20 01:07 shoaibsharif