Search code examples
google-cloud-platformoauthgoogle-gemini

Difficulty setting up Oauth, Error (400): invalid_scope


I would like to tune google gemini for a project, and this requires Oauth2.0, to store data. I've been following the documentation.

I have the scopes enabled in the Oauth consent screen, so I really don't know what causes this issue. The enabled scopes

After I try to log in to set up the credentials I get this error:

Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/generative-language.tuning%5C%5C%5C], invalid=['https://www.googleapis.com/auth/cloud-platform, https://www.googleapis.com/auth/generative-language.retriever'\]}

also this one: Error (400): invalid_scope

this is the command I used:

gcloud auth application-default login --client-id-file=client_secret.json --scopes='https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/generative-language.tuning,https://www.googleapis.com/auth/generative-language.retriever'

Any help with this would be greatly appreciated, thank you.


Solution

  • First Updated gcloud to latest version.

    Second as DazWilkin suggested I replaced the single-quotes (') with double-quotes (") like so:

    gcloud auth application-default login --client-id-file=client_secret.json --scopes="https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/generative-language.retriever,https://www.googleapis.com/auth/generative-language.tuning"