From b8cc881d36644f754c065ff34f4331eadcafffff Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Thu, 29 Jul 2021 06:35:03 +0100 Subject: [PATCH] Populate refresh token from a client credentials OAuth2 call (#3794) --- .../o-auth-2/__tests__/grant-client-credentials.test.ts | 4 ++++ .../app/network/o-auth-2/grant-client-credentials.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.ts b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.ts index 43c66f133d..18a588367d 100644 --- a/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.ts +++ b/packages/insomnia-app/app/network/o-auth-2/__tests__/grant-client-credentials.test.ts @@ -23,6 +23,7 @@ describe('client_credentials', () => { bodyPath, JSON.stringify({ access_token: 'token_123', + refresh_token: 'token_456', token_type: 'token_type', scope: SCOPE, audience: AUDIENCE, @@ -100,6 +101,7 @@ describe('client_credentials', () => { expect(result).toEqual({ access_token: 'token_123', id_token: null, + refresh_token: 'token_456', expires_in: null, token_type: 'token_type', scope: SCOPE, @@ -118,6 +120,7 @@ describe('client_credentials', () => { bodyPath, JSON.stringify({ access_token: 'token_123', + refresh_token: 'token_456', token_type: 'token_type', scope: SCOPE, audience: AUDIENCE, @@ -199,6 +202,7 @@ describe('client_credentials', () => { expect(result).toEqual({ access_token: 'token_123', id_token: null, + refresh_token: 'token_456', expires_in: null, token_type: 'token_type', scope: SCOPE, diff --git a/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.ts b/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.ts index 850070bb77..7510a1122f 100644 --- a/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.ts +++ b/packages/insomnia-app/app/network/o-auth-2/grant-client-credentials.ts @@ -93,6 +93,7 @@ export default async function( const results = responseToObject(bodyBuffer.toString('utf8'), [ c.P_ACCESS_TOKEN, c.P_ID_TOKEN, + c.P_REFRESH_TOKEN, c.P_TOKEN_TYPE, c.P_EXPIRES_IN, c.P_SCOPE,