Oauth2: cannot fetch token: Post "https://oauth2.googleapis.com/token": Service Unavailable

What is the problem you are having with rclone?

I am facing oauth2: cannot fetch token issue and get this error

ERROR : : error reading destination directory: Get "https://storage.googleapis.com/storage/v1/b/xxx-xxxx-dev-nginx-www-etl/o?alt=json&delimiter=%2F&maxResults=1000&prefix=vanity%2Frewrites.d%2F&prettyPrint=false": oauth2: cannot fetch token: Post "https://oauth2.googleapis.com/token": Service Unavailable

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

rclone v1.55.1

  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.3
  • go/linking: static
  • go/tags: none

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

Google Cloud Storage

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


rclone sync -vvv /usr/share/servaccts/geomap1/vanity/rewrites.d/  xxx-etl-gcp:dev-nginx-www-etl/vanity/rewrites.d/

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[gcs-etl-gcp]
type = google cloud storage
client_id = 10xxxxxxx
service_account_file = /home/jboss/.config/rclone/service-account.json
bucket_policy_only = true

A log from the command that you were trying to run with the -vv flag

2023/12/08 19:10:36 DEBUG : Using config file from "/home/jboss/.config/rclone/rclone.conf"
2023/12/08 19:10:36 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "sync" "-vv" "/usr/share/servaccts/geomap1/vanity/rewrites.d/" "gcs-etl-gcp:dev-nginx-www-etl/vanity/rewrites.d/"]
2023/12/08 19:10:36 DEBUG : Creating backend with remote "/usr/share/servaccts/geomap1/vanity/rewrites.d/"
2023/12/08 19:10:36 DEBUG : Creating backend with remote "xxx:xxx-ecom-dev-nginx-www-etl/vanity/rewrites.d/"
2023/12/08 19:10:36 DEBUG : pacer: Reducing sleep to 5.065151ms
2023/12/08 19:10:36 DEBUG : fs cache: renaming cache item "pentaho-etl-gcp:xxx-ecom-dev-nginx-www-etl/vanity/rewrites.d/" to be canonical "xxx-etl-gcp:xxx-xxx-dev-nginx-www-etl/vanity/rewrites.d"
2023/12/08 19:10:36 DEBUG : pacer: Reducing sleep to 8.978627ms
2023/12/08 19:10:36 ERROR : error reading destination directory: Get "https://storage.googleapis.com/storage/v1/b/xxx-xxx-dev-nginx-www-etl/o?alt=json&delimiter=%2F&maxResults=1000&prefix=vanity%2Frewrites.d%2F&prettyPrint=false": **oauth2: cannot fetch token: Post "https://oauth2.googleapis.com/token": Service Unavailable**


Curl out put
curl -I https://oauth2.googleapis.com/token
HTTP/1.1 503 Service Unavailable
Server: squid/3.5.26
Mime-Version: 1.0
Date: Sat, 09 Dec 2023 01:13:57 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 8165
X-Squid-Error: ERR_DNS_FAIL 0

curl: (56) Received HTTP code 503 from proxy after CONNECT
-->

I also noticed when I try to access the URL 

// https://storage.googleapis.com/storage/v1/b/xxx-xxx-dev-nginx-xxx-etl/o?alt=json&delimiter=%2F&maxResults=1000&prefix=vanity%2Frewrites.d%2F&prettyPrint=false

{
  "error": {
    **"code": 401,**
    **"message": "Anonymous caller does not have storage.objects.list access to the Google Cloud Storage bucket. Permission 'storage.objects.list' denied on resource (or it may not exist).",**
    "errors": [
      {
        "message": "Anonymous caller does not have storage.objects.list access to the Google Cloud Storage bucket. Permission 'storage.objects.list' denied on resource (or it may not exist).",
        "domain": "global",
        "reason": "required",
        "locationType": "header",
        "location": "Authorization"
      }
    ]
  }
}

You need to update rclone.

@Animosity022 - Thank you, Do you mean an update to the rclone version or its configuration? If so, could you explain why you believe the update is necessary to resolve this issue?

Also, Could you please direct me to the rclone update documentation for google cloud storage?

Yes, update rclone:

Install (rclone.org)

Google Cloud Storage (rclone.org)

@Animosity022 - Which version of rclone would you suggest updating, and what prompts your belief that this update will resolve the issue or is otherwise related to it?

Update to the latest version available (1.65 now). You are using many years old one - ancient effectively given that new rclone release happens every couple of months. rclone is single file self contained program without any deps - so no risk of breaking anything here.

Nobody knows it 100% but it is waste of time to investigate old version problem given how many things changed/were fixed/were added since then. Unless somebody is vintage computing fan.

Your repository provided version is clearly not maintained - it is quite common in linux unfortunately.

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