ChromeOS + Termux + rclone + Google Drive = invalid_grant error

I followed the directions on the wiki for installing rclone on termux. That was successful, so I moved to the next step - configuring a remote for Google Drive.

Running rclone config, I selected (n)ew remote, named it, selected (11) Google Drive, left client_id and client_secret blank, selected (1) Full access, left root_folder_id and service_account_file blank…and then we get to the “auto config” options.

If I select autoconfig = yes, then a chrome browser tab opens for http:// 127.0.0.1:53682:auth, but chrome displays an error “This site cannot be reached. 127.0.0.1 refused to connect. ERR_CONNECTION_REFUSED” and the termux session with rclone just sits around “Waiting for code…”

If I select autoconfig = no, then chrome opens a browser tab for https:// accounts.google.com/ that says “rclone wants to View and manage the files in your Google drive. Allow rclone to do this?” If I client “Allow”, then I get an page with a 58 digit code. I copy that code then go back to termux/rclone and paste it in. rclone returns an error:
Failed to configure token: failed to get token: oauth2: cannot fetch token: 400 Bad Request
Response : {
“error” : “invalid_grant”
}

Any thoughts?

That should work I would have thought…

I just tried it (not on termux) and it worked fine.

Cut and paste error?

If you really can’t get it to work then you can use one of these methods

That was my first thought, but I’ve tried typing in all 57 digits manually with the same error.

Using rclone authorize has the same issue as “autoconfig = yes” --> the browser opens and returns a “This site can’t be reached” error and I can’t use the “config file” option since I don’t have a config file created successfully yet (unless I’m misinterpreting what the directions are saying).

So…I was running rclone from within the (main) Termux session. On a whim, I decided to rclone from within a SSH session (using the Secure Shell app). “autoconfig = yes” continued to throw the same error. However, “autoconfig = no” succeeded after the copy/paste of the code from the browser into the ssh session.

So…it appears that there is a problem with the paste into the Termux session.

Thanks for the help! Now I’m off to play with rlcone…

How strange…

I have to say I copied the config file from my computer to termux with scp rather than set it up on the phone.