diff --git a/src/auth/oauth2client.ts b/src/auth/oauth2client.ts index 046863f5..47809098 100644 --- a/src/auth/oauth2client.ts +++ b/src/auth/oauth2client.ts @@ -1018,9 +1018,9 @@ export class OAuth2Client extends AuthClient { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded', + Authorization: `Bearer ${accessToken}`, }, url: OAuth2Client.GOOGLE_TOKEN_INFO_URL, - data: querystring.stringify({access_token: accessToken}), }); const info = Object.assign( { diff --git a/test/test.oauth2.ts b/test/test.oauth2.ts index e53fbcaa..62fd416a 100644 --- a/test/test.oauth2.ts +++ b/test/test.oauth2.ts @@ -1322,18 +1322,13 @@ describe('oauth2', () => { expires_in: 1234, }; - const scope = nock(baseUrl) - .post( - '/tokeninfo', - qs.stringify({ - access_token: accessToken, - }), - { - reqheaders: { - 'content-type': 'application/x-www-form-urlencoded', - }, - } - ) + const scope = nock(baseUrl, { + reqheaders: { + 'content-type': 'application/x-www-form-urlencoded', + authorization: `Bearer ${accessToken}`, + }, + }) + .post('/tokeninfo', () => true) .reply(200, tokenInfo); const info = await client.getTokenInfo(accessToken);