From bc699be15471807e693b8ebe2b26b8d776e13275 Mon Sep 17 00:00:00 2001 From: Rodrigo Borges Date: Thu, 5 Sep 2024 21:13:09 -0300 Subject: [PATCH] Fix access_token flow not returning the user info 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. --- src/strategy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategy.ts b/src/strategy.ts index b20d553..439311a 100644 --- a/src/strategy.ts +++ b/src/strategy.ts @@ -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, {