fix: Don't break oauth credentials when updating them and allow fixing broken oauth credentials by repeating the authorization flow (#12563)

This commit is contained in:
Danny Martini
2025-01-13 13:48:16 +01:00
committed by GitHub
parent bee7267fe3
commit 73897c7662
5 changed files with 152 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ export class OAuth2CredentialController extends AbstractOAuthController {
set(oauthToken.data, 'callbackQueryString', omit(req.query, 'state', 'code'));
}
if (decryptedDataOriginal.oauthTokenData) {
if (typeof decryptedDataOriginal.oauthTokenData === 'object') {
// Only overwrite supplied data as some providers do for example just return the
// refresh_token on the very first request and not on subsequent ones.
Object.assign(decryptedDataOriginal.oauthTokenData, oauthToken.data);