From efa4c567579d88f9ce764c535dfb41e7391a1286 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Thu, 15 Dec 2022 10:54:34 +0200 Subject: [PATCH] fix(core): Fix for Google and Microsoft generic OAuth2 credentials --- packages/cli/src/credentials/oauth2Credential.api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/credentials/oauth2Credential.api.ts b/packages/cli/src/credentials/oauth2Credential.api.ts index e3767a2330..452970ee04 100644 --- a/packages/cli/src/credentials/oauth2Credential.api.ts +++ b/packages/cli/src/credentials/oauth2Credential.api.ts @@ -93,10 +93,12 @@ oauth2CredentialController.get( // At some point in the past we saved hidden scopes to credentials (but shouldn't) // Delete scope before applying defaults to make sure new scopes are present on reconnect + // Generic Oauth2 API is an exception because it needs to save the scope + const genericOAuth2 = ['oAuth2Api', 'googleOAuth2Api', 'microsoftOAuth2Api']; if ( decryptedDataOriginal?.scope && credentialType.includes('OAuth2') && - !['oAuth2Api'].includes(credentialType) + !genericOAuth2.includes(credentialType) ) { delete decryptedDataOriginal.scope; }