commit 1608444ca48f8db3ec731805d330a5b13b05a6a3
parent 3edfeed71c533714dd28f9af6d0198da879ebc19
Author: Michael Rasmussen <mir@datanom.net>
Date: Sat, 3 Feb 2024 23:16:59 +0100
Fix bug #4762 oauth2: preserve an existing refresh token patch by Olaf Hering
Signed-off-by: Michael Rasmussen <mir@datanom.net>
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/oauth2.c b/src/oauth2.c
@@ -663,7 +663,8 @@ gint oauth2_check_passwds (PrefsAccount *ac_prefs)
passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_SEND, OAUTH2Data->access_token, FALSE);
passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_OAUTH2_EXPIRY, OAUTH2Data->expiry_str, FALSE);
//Some providers issue replacement refresh tokens with each access token. Re-store whether replaced or not.
- passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_OAUTH2_REFRESH, OAUTH2Data->refresh_token, FALSE);
+ if (OAUTH2Data->refresh_token != NULL)
+ passwd_store_set_account(ac_prefs->account_id, PWS_ACCOUNT_OAUTH2_REFRESH, OAUTH2Data->refresh_token, FALSE);
passwd_store_write_config();
log_message(LOG_PROTOCOL, _("OAuth2 access and refresh token updated\n"));
}