Google user profile claims not showing up in the JWT #3014
-
How do I get a JWT from Google that contains the user profile claims (name, picture, etc)? I am aware that this library performs a separate call to Google (with https://www.googleapis.com/oauth2/v1/tokeninfo?alt=json) after getting the id token to fetch the profile for the purpose of front-end consumption. The issue with this is that I need the claims to be in the bearer token since I pass the JWT token directly to a backend server and it uses profile claims (such as name and picture) directly. Yes, I added the profile scope to the next-auth Google provider object. React-Google-Login (react-google-login) which I migrated from provided me with a token that contained all profile claims. This may be due to the client JS Google library being entirely different. Here are some resources that may be relevant. None of them were able to help me figure it out unfortunately. https://stackoverflow.com/questions/32175174/is-it-possible-to-get-profile-information-in-an-id-token-from-google Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The v4 Google provider will use the OIDC well known configuration and thus return you the ID token. See the code here https://github.com/nextauthjs/next-auth/blob/beta/src/providers/google.ts keep in mind that you should use the access token for API requests, not the ID token. |
Beta Was this translation helpful? Give feedback.
The v4 Google provider will use the OIDC well known configuration and thus return you the ID token.
See the code here https://github.com/nextauthjs/next-auth/blob/beta/src/providers/google.ts
keep in mind that you should use the access token for API requests, not the ID token.