Can't get a OneDrive token

Can't get a OneDrive token.The browser says it was successful: "Success! All done. Please go back to rclone." But rclone gives an error.
2023/02/17 16:42:21 Fatal error: failed to get token: oauth2: cannot fetch token: 400 Bad Request
Response: {"error":"invalid_grant","error_description":"AADSTS70000: The provided value for the 'code' parameter is not valid. The code has expired.\r\nTrace ID: b3a879b0-d0ee-4e20-9218-2dd8a3f6ac00\r\nCorrelation ID: 4e330f19-c3e5-4fdf-a339-6692a9ce2ab9\r\nTimestamp: 2023-02-17 12:42:21Z","error_codes":[70000],"timestamp":"2023-02-17 12:42:21Z","trace_id":"b3a879b0-d0ee-4e20-9218-2dd8a3f6ac00","correlation_id":"4e330f19-c3e5-4fdf-a339-6692a9ce2ab9","error_uri":""}

Run the command 'rclone version' and share the full output of the command.

rclone v1.61.1

  • os/version: ubuntu 22.04 (64 bit)
  • os/kernel: 5.15.0-60-generic (x86_64)
  • os/type: linux
  • os/arch: amd64
  • go/version: go1.19.4
  • go/linking: static
  • go/tags: none

Which cloud storage system are you using? (eg Google Drive)


How exactly did you do the rclone config? Were you using remote config?

Is the time and timezone set correctly on your computer? Oauth is very sensitive to that?

On Ubuntu, I enter client_id, client_secret, then select N (if running rclone on a (remote) machine without web browser access).
Then I copied this: rclone authorize "onedrive" "xxxxxxxxxxxx". After I paste the code into a running instance of rclone 1.61.1 on Windows. Browser success, Microsoft sent an email that a new application is connected to my account, but no token.
The time is set the same on Ubuntu and Windows.

Try setting it up on Windows and then copying the config file to ubuntu. You can find where the config file is with rclone config file so copy it from this location on Windows , run rclone config file on Ubuntu and copy it there.

Thank you very much! It all worked out :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.