mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 20:00:02 +00:00
⚡ Do not overwrite all oauth data on reconnect #PROD-24
This commit is contained in:
@@ -1032,7 +1032,15 @@ class App {
|
||||
return ResponseHelper.sendErrorResponse(res, errorResponse);
|
||||
}
|
||||
|
||||
savedCredentialsData.oauthTokenData = oauthToken.data;
|
||||
if (savedCredentialsData.oauthTokenData) {
|
||||
// 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(savedCredentialsData.oauthTokenData, oauthToken.data);
|
||||
} else {
|
||||
// No data exists so simply set
|
||||
savedCredentialsData.oauthTokenData = oauthToken.data;
|
||||
}
|
||||
|
||||
_.unset(savedCredentialsData, 'csrfSecret');
|
||||
|
||||
credentials.setData(savedCredentialsData, encryptionKey);
|
||||
|
||||
Reference in New Issue
Block a user