DEV Community

Grigor
Grigor

Posted on

Adding next-auth access_token to apollo client queries

Attempting to use next-auth with next (v13). I have a setup where Google Provider successfully logs me in. What I want to do is pass in the access_token to the backend so I can verify requests with Google oAuth API before processing data. My question is, what is the proper way of setting this header using Apollo Client? I have SSR and Client queries, and I want to pass in an Authorization header with every request. Should I store the access_token in cookies then grab it from there using setContext?

Top comments (0)