Authorization Error Error 400: invalid_request configuring rclone gdrive

2.7k views Asked by At

I'm unable to configure gdrive for rclone, giving 400 error.

enter image description here

enter image description here

enter image description here

enter image description here

1

There are 1 answers

1
James Lownie On

According to this post this error message may be caused by using an old version of rclone. Try installing the latest version if you haven't already done that.

Also you shouldn't post your client ID and secret. You should revoke them and re-create them.

I am using rclone 1.60, I still got the same error but I fixed it. You need to add rclone's Redirect URL to the Authorized redirect URIs section of the OAuth 2.0 Client ID that you created for rclone (in the Google API console).

First create your own client ID as described on the rclone website. Make sure it has a secret - click 'Reset Secret' if it doesn't. Remember to save after creating the secret.

Then you need to get the redirect URL:

  1. Start rclone config and proceed through the wizard, giving it the client ID and the secret when it asks for it.
  2. Continue with rclone config until it gets to the auto config part of the wizard (Use auto config?). Answer 'n' to this question.
  3. In its output rclone gives you a command to execute that looks like this: clone authorize "drive" "XXXX". Execute that command in another terminal session.
  4. The rclone authorize command will cause the Google Accounts page to be opened, which gets the error message Error 400: redirect_uri_mismatch
  5. In the rclone output is this text: Make sure your Redirect URL is set to "http://127.0.0.1:53682/"

Now you need to add the redirect URL to the Client ID's Authorized redirect URIs.

  1. Go to the Google API console
  2. Click on 'Credentials' in the left part of the screen.
  3. Click on Client ID in the section 'OAuth 2.0 Client IDs'.
  4. Put the Redirect URL in the section 'Authorized redirect URIs' and click 'Save'.

Complete the authorization process:

  1. Go back to the rclone authorize session - in its output there will be a line that starts with 'If your browser doesn't open automatically...'. Follow the link in that line. The web page that opens will say 'Success!'.
  2. The rclone authorize session will have produced a token. Copy that token and paste it into the rclone config session (which is waiting for a token).
  3. Complete the wizard. The remote should be setup and working now.