Skip to content

Commit

Permalink
Fix access_token flow not returning the user info
Browse files Browse the repository at this point in the history
The access_token flow was failing to parse the response from
https://www.googleapis.com/oauth2/v3/userinfo. Since the response's body comes
back as a JSON object, we need to tell `got` to retrieve it directly.
  • Loading branch information
rodrigoborgesdeoliveira committed Sep 6, 2024
1 parent 36e21d1 commit bc699be
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class GoogleTokenStrategy extends Strategy {
}

// Now we have to get the userinfo from the token
got.get(`https://www.googleapis.com/oauth2/v3/userinfo?access_token=${accessToken}`).then(userinfo => {
got.get(`https://www.googleapis.com/oauth2/v3/userinfo?access_token=${accessToken}`).json().then(userinfo => {
this.done(null, userinfo)
}).catch(e => {
this.done(null, false, {
Expand Down

0 comments on commit bc699be

Please sign in to comment.