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
Forwarding client token cookie to server requests #560
Comments
I use a cookie to persist the token for SSR purposes, but then for all my API requests I send an
If a token cookie is present on the server, I populate it into redux state (which is wasteful I know because we are sending it via initial state and cookie, but whatevs). And then I have a special redux middleware to set the Some code just to give you the idea; Of course the hard part is wiring up all the plumbing for this 😉 .
Then this is an abstracted part of my middleware, but runs on every action
|
Great! My solution was very similar to yours, I ended up also adding the token to the store and dispatching it on every action. Thanks! |
Hello,
I'm working on an isomorphic reactjs app, using axios for client and server requests.
When authenticating a user I use express-jwt to set the client cookie. Making a browser request to my protected endpoint works perfectly, but my problem is when the request is done on the server side (required to create the initial redux store).
I'm not being able to forward the client cookie to other requests made in the server side. Is there any way to forward my client cookies?
The text was updated successfully, but these errors were encountered: