diff --git a/src/index.ts b/src/index.ts index 78db650..dfd9383 100644 --- a/src/index.ts +++ b/src/index.ts @@ -327,7 +327,7 @@ export class GoogleToken { grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', assertion: signedJWT, }, - headers: {'Content-Type': 'application/x-www-form-urlencoded'}, + headers: {'Content-Type': 'application/json'}, responseType: 'json', }); this.rawToken = r.data; diff --git a/test/index.ts b/test/index.ts index 784f985..69de6c1 100644 --- a/test/index.ts +++ b/test/index.ts @@ -610,16 +610,14 @@ describe('.getToken()', () => { }); function createGetTokenMock(code = 200, body?: {}) { - return nock(GOOGLE_TOKEN_URLS[0]) + return nock(GOOGLE_TOKEN_URLS[0], { + reqheaders: {'Content-Type': 'application/json'}, + }) .replyContentLength() - .post( - GOOGLE_TOKEN_URLS[1], - { - grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', - assertion: /.?/, - }, - {reqheaders: {'Content-Type': 'application/x-www-form-urlencoded'}} - ) + .post(GOOGLE_TOKEN_URLS[1], { + grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer', + assertion: /.?/, + }) .reply(code, body); }