Skip to content

Use a Vertex-specific API scope in chat_google_vertex() #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

atheriel
Copy link
Collaborator

@atheriel atheriel commented Jun 4, 2025

This is an attempt to resolve #523. Google's API in that case seems to be indicating that a different scope is required to access Vertex AI compared to Gemini:

Error in `req_perform_connection()`:
! HTTP 403 Forbidden.
* OAuth error: insufficient_scope
* realm: https://accounts.google.com/
* scope: https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/cloud-vertex-ai.firstparty.predict
* Request had insufficient authentication scopes.

Of the options listed in that error message
https://www.googleapis.com/auth/cloud-vertex-ai.firstparty.predict is the least privileged scope, so that's the one I've opted for.

This is an attempt to resolve #523. Google's API in that case seems to
be indicating that a different scope is required to access Vertex AI
compared to Gemini:

    Error in `req_perform_connection()`:
    ! HTTP 403 Forbidden.
    * OAuth error: insufficient_scope
    * realm: https://accounts.google.com/
    * scope: https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/cloud-platform.read-only https://www.googleapis.com/auth/cloud-vertex-ai.firstparty.predict
    * Request had insufficient authentication scopes.

Of the options listed in that error message
`https://www.googleapis.com/auth/cloud-vertex-ai.firstparty.predict` is
the least privileged scope, so that's the one I've opted for.

Signed-off-by: Aaron Jacobs <[email protected]>
Co-authored-by: Hadley Wickham <[email protected]>
@atheriel
Copy link
Collaborator Author

atheriel commented Jun 6, 2025

Note: I don't want to merge this without some real testing, because it might break existing Vertex AI users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue in chat_google_vertex: HTTP 403 Forbidden due to insufficient authentication scopes
2 participants