diff --git a/src/auth/oauth2client.ts b/src/auth/oauth2client.ts index 01edf9fc..9719212c 100644 --- a/src/auth/oauth2client.ts +++ b/src/auth/oauth2client.ts @@ -1015,9 +1015,12 @@ export class OAuth2Client extends AuthClient { */ async getTokenInfo(accessToken: string): Promise { const {data} = await this.transporter.request({ - method: 'GET', + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, url: OAuth2Client.GOOGLE_TOKEN_INFO_URL, - params: {access_token: accessToken}, + data: querystring.stringify({access_token: accessToken}), }); const info = Object.assign( { diff --git a/test/test.oauth2.ts b/test/test.oauth2.ts index dffa899e..e53fbcaa 100644 --- a/test/test.oauth2.ts +++ b/test/test.oauth2.ts @@ -1323,7 +1323,17 @@ describe('oauth2', () => { }; const scope = nock(baseUrl) - .get(`/tokeninfo?access_token=${accessToken}`) + .post( + '/tokeninfo', + qs.stringify({ + access_token: accessToken, + }), + { + reqheaders: { + 'content-type': 'application/x-www-form-urlencoded', + }, + } + ) .reply(200, tokenInfo); const info = await client.getTokenInfo(accessToken);