Skip to content

Commit

Permalink
fix: move accessToken to headers instead of parameter (#1108)
Browse files Browse the repository at this point in the history
  • Loading branch information
sofisl committed Dec 18, 2020
1 parent bf5ced3 commit 67b0cc3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/auth/oauth2client.ts
Expand Up @@ -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(
{
Expand Down
19 changes: 7 additions & 12 deletions test/test.oauth2.ts
Expand Up @@ -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);
Expand Down

0 comments on commit 67b0cc3

Please sign in to comment.