Proper way to get response headers from API #1240
-
I'm using next-urql & exchange-auth packages to do the authentication, my api server automatically refreshed token and responses via headers. Is there any way to get response headers instead of I must implement a custom fetchExchange? (which seems not a good idea solution) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Generally I'd advise to use cookies for this purpose, you could also choose to return the new token as part of the extensions field. You should also consider the point that implicit token refreshes often lead to scenario's where in multiple concurrent calls multiple tokens are refreshed at the same time which can end up leaving the user with an invalidated token. |
Beta Was this translation helpful? Give feedback.
Generally I'd advise to use cookies for this purpose, you could also choose to return the new token as part of the extensions field. You should also consider the point that implicit token refreshes often lead to scenario's where in multiple concurrent calls multiple tokens are refreshed at the same time which can end up leaving the user with an invalidated token.