Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Adding cloud-platform scopes to google cloud sdk auth

I'm having an error when generating auth tokens in the terminal with the cloud-platform scope.
When I run:
```
gcloud auth application-default login --scopes https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/cloud-platform
```

I have an error in the token generation:
```
ERROR: (gcloud.auth.application-default.login) There was a problem refreshing your current auth tokens: None could not be converted to bytes
Please run:

$ gcloud auth login

to obtain new credentials.

If you have already logged in with a different account, run:

$ gcloud config set account ACCOUNT

to select an already authenticated account to use.
```
The suggested actions (re-login and change account) don't work.
My colleagues (with the same permissions as myself) have no issue running this command and authentication. This issue is persistent for my account in other machines.

Both the SDK documentation and gemini suggestions have no solution. I tried all of these:

Troubleshooting Steps
- Re-authenticate with gcloud auth login:
- Open your terminal or command prompt.
- Run: gcloud auth login
- Follow the prompts to authenticate with your Google account in your web browser.
Check GOOGLE_APPLICATION_CREDENTIALS (if applicable):
- If you're using a service account key file:
- Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable is set correctly and points to the absolute path of your service account key file.
- Verify that the key file exists and has the correct permissions.
- Clear gcloud Credentials Cache:
- Run: gcloud auth application-default revoke
- Try the original command again: gcloud auth application-default login --scopes https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/cloud-platform
- Update or Reinstall Google Cloud SDK:
- Update: gcloud components update
- Reinstall (if the issue persists): Follow the instructions for your operating system on the official Google Cloud SDK installation page: https://cloud.google.com/sdk/docs/install

Solved Solved
0 4 1,099
1 ACCEPTED SOLUTION

Downgraded Google Cloud SDK version to 492.0.0 and this error is no longer happening

View solution in original post

4 REPLIES 4

Hi @sf_digestaid

Welcome to Google Cloud Community!

Have you tried to run this command?

 

gcloud auth application-default login --scopes=https://www.googleapis.com/auth/cloud-platform,openid,https://www.googleapis.com/auth/userinfo.email

 

Also, please check if your server’s clock is in sync with the NTP. May I know what region and zone you are using/working on?

I’ve also seen that you already created an issue case regarding this one, you can make a follow up on your case if the above workaround still didn’t fix your issue. However, please be informed that I can’t provide a timeline as to when it will be fixed.

I hope the above information is helpful.

Hi @ronnelg thanks for the reply!

I ran the command mentioned with no errors. The output was:

 

Credentials saved to file: [/<defaultpath>/application_default_credentials.json]

These credentials will be used by any library that requests Application Default Credentials (ADC).

Quota project "<projectname>" was added to ADC which can be used by Google client libraries for billing and quota. Note that some services may still bill the project owning the resource.

 

I'm working from Portugal (timezone WET - Lisbon). I had my clock in sync with time.apple.com and just switched it to time.google.com.

Currently the issue still stands, the same error happens when adding the scopes for the google drive and cloud platform. If anything cghanges I'll make sure to update both posts.

Thanks for the help.

 

Downgraded Google Cloud SDK version to 492.0.0 and this error is no longer happening

This started happening to me as well following an update to 499.0.0. The downgrade to 492.0.0 fixed my issue as well. Thanks @sf_digestaid !!!