Jottacloud Error 401 (Unauthorized)

I followed Jottacloud removed basic authentication, Duplicati can no longer connect · Issue #4697 · duplicati/duplicati · GitHub, i think it is private that is why you can’t find it, But can ask

1 Like

docker pull skaro13/duplicati-linuxserver:v2.0.6.3-2.0.6.3_beta_2021-06-17-ls135_pr-4699

1 Like

I can confirm that the PR #4699 is working.
Using it with the docker image from skaro13.

Got an error on the OAuth beta server while trying to repair a database.

Failed to dispose backend instance: Failed to authorize using the OAuth service: Too many request for this key, wait 60 minutes. If the problem persists, try generating a new authid token from: Duplicati Beta OAuth Handler

Is this error related to limitations to the OAuth beta server or Jottacloud? And if it is a limitation to the beta server are there the same limitations to the production server?

The error message comes from the oauth service:

The rate limit feature can be enabled or disabled, default disabled:

The configuration template “suggests” enabling it with a value of 4 (requests per hour):

It was obviously enabled on the beta service instance (perhaps with the value 4 from the template), but I have no idea if it is enabled or not in the prod service. I have seen the message myself when testing the beta service, but have no prior experience with the oauth service so don’t know how the prod instance behaves.

1 Like

Great news: Support for Jottacloud OAuth (via CLI token) is “official” :partying_face: .

Big thanks to @jthall for your valuable input, and for your effort with the beta oauth service! :clap:

Please test with latest canary and report any issues. Not all of the steps described previously will now be necessary, but something like this:

  • Visit https://jottacloud.com/web/secure and log in. Click “Generate” in the “Personal login token” section, and enter your password again. Copy the resultant CLI token.
  • Open Duplicati, and edit a backup or create a new backup.
  • Click the “AuthID” link to open a “pop-up” with the official OAuth service showing Jottacloud only. Alternatively just open the main page of the oauth service at https://duplicati-oauth-handler.appspot.com in another tab. Click “Jottacloud login”, paste in the token obtained in the previous step and click “Login”. Copy the resultant AuthID.
  • Paste in the AuthID you obtained previously in the “AuthID” field
  • Click test connection and if successful, click through with next and then click save.

Note that if you want to continue to use the same configuration as you have tested the early beta with, you need to remove the “oauth-url” option from the “Advanced options” to make it use the default production oauth handler web service, instead of the beta service that was set up for previous testing of this change. Also remember that you need to generate a completely new CLI token and AuthID, as described above, and replace the existing value in the “AuthId” option.

4 Likes

great news!

Is there a way to suppress the “warning”

[Warning-Duplicati.Library.Main.Controller-UnsupportedOption]: The supplied option --auth-username is not supported and will be ignored

You need to edit the target url.
Edit your backup → step 2 (target) → click on the three dots → copy target url to clipboard → three dots → import target url → paste url → delete the unsupported options → save

jottacloud://folder/subfolder/?auth-username=xxx&auth-password=yyy

Perfect - thank you! :slight_smile:

there is an even simpler method:
edit backup → target destination: switch ‘storage type’ to ‘Local Folder or Drive’, remove contents of ‘Username’ and ‘Password’, switch back to storage type ‘Jottacloud’ and continue

Many thanks to all contributors !!! Your hard efforts are very much appreciated!
My tests so far went all fine - backed up and restored small to medium sized batches

Works for me as well :slight_smile:

Here’s to confirm - it works smooth so far. Thanks for all the time and efforts to all the contributors who made our day to use Duplicati with Jottacloud. Hats down, guys

Edit: What’s the expiration time of this token?

Is there a way how to update tokens in all configs?

I’ve about 8-10 (still no sort/order function in duplicati :frowning_face: ) individual backup configurations - different timing, different folders,… - that all use the same jottacloud connection.

Some of those cover a lot of data (TBs) and their token expires during the operation - e.g. after all the time without backups, deleting old ones took over an hour, invalidating the token.

Now I can easily generate a new CLI and new OAuth token from it, but I got to replace it manually in each of those backup configurations each time that happens, otherwise, they won’t run on their normal schedule.

Another scenario with token failure - database recreate - in the middle of the process after several hours token just dies and further downloads fail, so database recreation is impossible to achieve.

I am having the same thing happen. I got a good set of backups last night, then it throw the error below. I have tried generating another OAUTH token and it tests fine, but when I actually go to run the backup, it fails.

Either way, thanks to the Duplicati team for the efforts thus far. I am just happy to have gotten a backup.

Failed: Failed to authorize using the OAuth service: Server error. If the problem persists, try generating a new authid token from: https://duplicati-oauth-handler.appspot.com?type=jottacloud
Details: Duplicati.Library.Interface.UserInformationException: Failed to authorize using the OAuth service: Server error. If the problem persists, try generating a new authid token from: https://duplicati-oauth-handler.appspot.com?type=jottacloud ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at Duplicati.Library.Utility.AsyncHttpRequest.AsyncWrapper.GetResponseOrStream()
   at Duplicati.Library.Utility.AsyncHttpRequest.GetResponse()
   at Duplicati.Library.JSONWebHelper.GetResponse(AsyncHttpRequest req, Object requestdata)
   at Duplicati.Library.JSONWebHelper.ReadJSONResponse[T](AsyncHttpRequest req, Object requestdata)
   at Duplicati.Library.OAuthHelper.GetTokenResponse[T]()
   at Duplicati.Library.OAuthHelper.get_AccessToken()
   --- End of inner exception stack trace ---
   at Duplicati.Library.OAuthHelper.get_AccessToken()
   at Duplicati.Library.OAuthHelper.CreateRequest(String url, String method, Boolean noAuthorization)
   at Duplicati.Library.JSONWebHelper.GetJSONData[T](String url, Action`1 setup, Action`1 setupbodyreq)
   at Duplicati.Library.Backend.JottacloudAuthHelper..ctor(String accessToken)
   at Duplicati.Library.Backend.Jottacloud..ctor(String url, Dictionary`2 options)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Duplicati.Library.DynamicLoader.BackendLoader.BackendLoaderSub.GetBackend(String url, Dictionary`2 options)
   at Duplicati.Library.Main.BackendManager..ctor(String backendurl, Options options, IBackendWriter statwriter, LocalDatabase database)
   at Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at CoCoL.ChannelExtensions.WaitForTaskOrThrow(Task task)
   at Duplicati.Library.Main.Controller.<>c__DisplayClass14_0.<Backup>b__0(BackupResults result)
   at Duplicati.Library.Main.Controller.RunAction[T](T result, String[]& paths, IFilter& filter, Action`1 method)

Log data:
2022-06-14 10:28:32 -07 - [Error-Duplicati.Library.Main.Operation.BackupHandler-FatalError]: Fatal error
Duplicati.Library.Interface.UserInformationException: Failed to authorize using the OAuth service: Server error. If the problem persists, try generating a new authid token from: https://duplicati-oauth-handler.appspot.com?type=jottacloud ---> System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
   at Duplicati.Library.Utility.AsyncHttpRequest.AsyncWrapper.GetResponseOrStream()
   at Duplicati.Library.Utility.AsyncHttpRequest.GetResponse()
   at Duplicati.Library.JSONWebHelper.GetResponse(AsyncHttpRequest req, Object requestdata)
   at Duplicati.Library.JSONWebHelper.ReadJSONResponse[T](AsyncHttpRequest req, Object requestdata)
   at Duplicati.Library.OAuthHelper.GetTokenResponse[T]()
   at Duplicati.Library.OAuthHelper.get_AccessToken()
   --- End of inner exception stack trace ---
   at Duplicati.Library.OAuthHelper.get_AccessToken()
   at Duplicati.Library.OAuthHelper.CreateRequest(String url, String method, Boolean noAuthorization)
   at Duplicati.Library.JSONWebHelper.GetJSONData[T](String url, Action`1 setup, Action`1 setupbodyreq)
   at Duplicati.Library.Backend.JottacloudAuthHelper..ctor(String accessToken)
   at Duplicati.Library.Backend.Jottacloud..ctor(String url, Dictionary`2 options)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Duplicati.Library.DynamicLoader.BackendLoader.BackendLoaderSub.GetBackend(String url, Dictionary`2 options)
   at Duplicati.Library.Main.BackendManager..ctor(String backendurl, Options options, IBackendWriter statwriter, LocalDatabase database)
   at Duplicati.Library.Main.Operation.BackupHandler.<RunAsync>d__20.MoveNext()

Thanks for the stack trace. I’m thinking the best (maybe only) way to get any further with this problem, is if @kenkendk is able to invest some time checking the logs on the oauth service, and see if there are any hints as to why it sometimes throws the HTTP 500 response back to Duplicati…

1 Like

No worries – LMK if you need any other logs.

@waLIEN It sounds like the token expires? Can you try testing with a token for a few minutes? Like once a minute for 10-15 minutes?

The OAuth implementation for Jottacloud is a bit different because they do not really support third-party apps like Duplicati yet, so it is possible that there needs to be some token refresh logic as well.

@albertony I found this in the logs:

Thanks for the log. I’ve seen this “stale token” error with Jottacloud before, and its been mentioned in rclone forum as well, but haven’t really figured out exactly what it means or what causes it. Something related to token refreshing for sure… But normally, refreshing the tokens just works almost whatever I do… :thinking:

From rclone forum:

It looks like jotta is invalidating a re-used refresh token (box does this too).

So, after token is refreshed, something is still using the old one in Duplicati? Plausible?