bigquery_credentials.py defines the following default scopes:
BIGQUERY_SCOPES = [
'https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/dataplex',
]
The valid Dataplex OAuth scopes are:
This leads to an oauth error:
Some requested scopes were invalid. {valid=[https://www.googleapis.com/auth/bigquery], invalid=[https://www.googleapis.com/auth/dataplex]}
To reproduce:
- pip install google-adk==1.27.0
- Initialise BigQueryCredentialsConfig(client_id=..., client_secret=...) without overriding scopes
- Trigger the OAuth consent flow via any BigQuery tool
- Observe invalid_scope error from Google's authorization server
Functional workaround (agent.py):
BIGQUERY_SCOPES = [
'https://www.googleapis.com/auth/bigquery',
'https://www.googleapis.com/auth/dataplex.read-write',
]
_bq_credentials_config = BigQueryCredentialsConfig(
client_id=OAUTH_CLIENT_ID,
client_secret=OAUTH_CLIENT_SECRET,
scopes=BIGQUERY_SCOPES,
)
bigquery_toolset = BigQueryToolset(
credentials_config=_bq_credentials_config, bigquery_tool_config=_bq_tool_config
)
