-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is the current way to add a token to the headers? #370
Comments
Rewrite concatenation like at common apollo client and noticed that it works fine if added header is 'authorization'. If I change it to 'AUTH-TOKEN' or authtoken, than some headers get missing. I can't use custom name for added header? Current code:
|
You should be able to use any kind of header here. We just forward that to |
@phryneas Have you any thoughts why can request became invalid than? Mozilla gives 400 status for request with added header named not authorization. |
@phryneas I'm very sorry for bothering, but the problem was at server settings. We've temporary added CORS_ALLOW_ORIGIN=['*'] and error has gone. Request sends without errors, all headers are valid. |
Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better. |
Sorry for the late reply from my side, I had to give a conference talk yesterday so I'm a bit swamped right now 😓 Great to hear you found it! |
Hi, thanks for your great product!
I try to add token to headers, but has no luck. The problem is that when I add token, a lot of other headers get missing and I get CORS error.
I found how you add x-custom-delay at headers in this example
https://github.com/apollographql/apollo-client-nextjs/blob/main/examples/hack-the-supergraph-ssr/app/ApolloWrapper.tsx
And add it to my code:
Here are headers when "...tokenHeader" is commented at the code. I've got status 200, but access denied at response
And here are when it's added
Would you be so kind to tell me is my code right?
I'm a little bit confused because Patrik's example here
#281 (comment)
I tried to include objects from @apollo/experimental-nextjs-app-support/ssr but got IDE warning that it's deprecated.
Thanks!
The text was updated successfully, but these errors were encountered: