Access Response Headers in Apollo Client
How to access response headers in Apollo client. This can be useful for storing the authorization header being sent from the server.
I have a server that sends back a new JWT with each response. There's a simple example on the Apollo docs of setting request headers, but no mention of accessing response headers.
The main reason to do this, was accessing the
Authorization header so that I could update a JWT token that I stored on the client side.
Adding the Link
Go into your Apollo Client…
Keep reading with a 7-day free trial
Subscribe to zach.codes to keep reading this post and get 7 days of free access to the full post archives.