diff options
-rw-r--r-- | Duplicati/Library/Backend/Jottacloud/JottacloudAuthHelper.cs | 1 | ||||
-rw-r--r-- | Duplicati/Library/Backend/OAuthHelper/OAuthHelper.cs | 12 |
2 files changed, 12 insertions, 1 deletions
diff --git a/Duplicati/Library/Backend/Jottacloud/JottacloudAuthHelper.cs b/Duplicati/Library/Backend/Jottacloud/JottacloudAuthHelper.cs index d8a5d2f48..b6b4a146d 100644 --- a/Duplicati/Library/Backend/Jottacloud/JottacloudAuthHelper.cs +++ b/Duplicati/Library/Backend/Jottacloud/JottacloudAuthHelper.cs @@ -28,6 +28,7 @@ namespace Duplicati.Library.Backend : base(accessToken, "jottacloud") { base.AutoAuthHeader = true; + base.AutoV2 = false; // Jottacloud is not v2 compatible because it generates a new refresh token with every access token refresh and invalidates the old. var userinfo = GetJSONData<UserInfo>(USERINFO_URL); if (userinfo == null || string.IsNullOrEmpty(userinfo.Username)) diff --git a/Duplicati/Library/Backend/OAuthHelper/OAuthHelper.cs b/Duplicati/Library/Backend/OAuthHelper/OAuthHelper.cs index 007376cc0..ca9212e7b 100644 --- a/Duplicati/Library/Backend/OAuthHelper/OAuthHelper.cs +++ b/Duplicati/Library/Backend/OAuthHelper/OAuthHelper.cs @@ -83,6 +83,16 @@ namespace Duplicati.Library /// Set to true if the provider does not use refresh tokens, but only access tokens
/// </summary>
public bool AccessTokenOnly { get; set; }
+ /// <summary>
+ /// If true (the default), when a v1 authid is being used it will be swapped
+ /// with a v2 authid, when the OAuth service returns one (which it dypically
+ /// does after a provider token refresh has been performed). Some providers
+ /// are not compatible with v2 authid, tyically because they generate a new
+ /// refresh token with every access token refresh and invalidates the old.
+ /// If the oauth service still returns a v2 authid for such a provider,
+ /// set this property to false to make Duplicati ignore it.
+ /// </summary>
+ public bool AutoV2 { get; set; } = true;
public OAuthHelper(string authid, string servicename, string useragent = null)
: base(useragent)
@@ -134,7 +144,7 @@ namespace Duplicati.Library var res = GetTokenResponse<OAuth_Service_Response>();
m_tokenExpires = DateTime.UtcNow.AddSeconds(res.expires - 30);
- if (!string.IsNullOrWhiteSpace(res.v2_authid))
+ if (AutoV2 && !string.IsNullOrWhiteSpace(res.v2_authid))
m_authid = res.v2_authid;
return m_token = res.access_token;
}
|