fix(core): Fix for Google and Microsoft generic OAuth2 credentials

This commit is contained in:
Michael Kret 2022-12-15 10:54:34 +02:00 committed by GitHub
parent ac066fc9f3
commit efa4c56757
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}