Error 400 when trying to migrate to Google Drive

What is the problem you are having with rclone?

I'm trying to migrate home directories to Google Drive. I'm able to impersonate my email address with a service account successfully but when I try and copy my files to my drive I get an error:

2023/08/14 17:06:36 Failed to create file system for "WWMig:": couldn't find root directory ID: Get "https://www.googleapis.com/drive/v3/files/root?alt=json&fields=id&prettyPrint=false&supportsAllDrives=true": oauth2: cannot fetch token: 400 Bad Request
Response: {
"error": "invalid_grant",
"error_description": "Invalid email or User ID"
}

When I put the link into my browser, this is what I get:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"errors": [
{
"message": "The request is missing a valid API key.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}

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

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

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone.exe copy "D:\share\homefolder" "WWMig:" --update --verbose --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s --drive-impersonate 'user@example.net'

The rclone config contents with secrets removed.

[WWMig]
type = drive
scope = drive
service_account_file = C:\Temp\driven-rider-393914-d872b62e7c47.json
team_drive = 

A log from the command with the -vv flag

2023/08/15 07:46:28 DEBUG : rclone: Version "v1.63.1" starting with parameters ["rclone.exe" "copy" "D:\\Share\\Homefolder" "WWMig:" "--update" "--verbose" "--transfers" "30" "--checkers" "8" "--contimeout" "60s" "--timeout" "300s" "--retries" "3" "--low-level-retries" "10" "--stats" "1s" "--drive-impersonate" "'user@example.nett'" "-vv"]
2023/08/15 07:46:28 DEBUG : Creating backend with remote "D:\\Share\\Homefolder"
2023/08/15 07:46:28 DEBUG : Using config file from "C:\\Users\\user\\AppData\\Roaming\\rclone\\rclone.conf"
2023/08/15 07:46:28 DEBUG : fs cache: renaming cache item "D:\\Share\\Homefolder" to be canonical "//?/D:/HOME/Share/homefolder"
2023/08/15 07:46:28 DEBUG : Creating backend with remote "WWMig:"
2023/08/15 07:46:28 DEBUG : WWMig: detected overridden config - adding "{nmtqP}" suffix to name
2023/08/15 07:46:28 Failed to create file system for "WWMig:": couldn't find root directory ID: Get "https://www.googleapis.com/drive/v3/files/root?alt=json&fields=id&prettyPrint=false&supportsAllDrives=true": oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Invalid email or User ID"
}

I suggest taking a look at https://rclone.org/drive/ under " Use case - Google Apps/G-suite account and individual Drive"

Pretty sure you need client id/secret. Also, are you actually using 'user@example.net' in your command?

I followed that section when I configured everything. In that particular example, they only used the JSON file for service account authentication. I've also tried it by adding the client id (no secret was provided though). Also, I'm not using user@example.net in the actual command. In the actual command, I'm using my domain email account. I don't post active email addresses if I can help it.

The syntax was wrong. The single quotes around the email address were the issue.

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