Error " Invalid OAuth scope or ID token audience provided" with Agent using a service account from a credential json file #1009
Unanswered
webravolab
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, i'm experiencing a weird problem trying to connect one Adk agent to an MCP server (using Toolbox), both deployed on Google Cloud Run. The MCP server requires IAM authentication, and I'm trying to make the Agent run as a service account that has the permissions to connect to the MCP server.
I'm using Application Default Credentials by providing the agent with a credential json file, and setting the GOOGLE_APPLICATION_CREDENTIAL env variable.
Connecting to the agent via Cloud Run public url it loads ok, but just typing "Hi" in the chat i received the following error:
google.auth.exceptions.RefreshError: ('invalid_scope: Invalid OAuth scope or ID token audience provided.', {'error': 'invalid_scope', 'error_description': 'Invalid OAuth scope or ID token audience provided.'})
The stack shows the error comes from _get_runner_async() in fast_api.py
I've tried to give the service account all the possible roles and permissions but don't seems to be related with roles.
I've also tried to add the service account id in Google Workspace giving the scope https://www.googleapis.com/auth/cloud-platform but nothing changed.
Any suggestion on the cause and how to fix it?
Here is my Agent code snippet:
Beta Was this translation helpful? Give feedback.
All reactions