Do not overwrite all oauth data on reconnect #PROD-24

This commit is contained in:
Jan Oberhauser 2020-05-13 01:07:34 +02:00
parent ea47e8b1bc
commit 74fac1e56c

View file

@ -1032,7 +1032,15 @@ class App {
return ResponseHelper.sendErrorResponse(res, errorResponse);
}
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);