You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(bigquery): support custom oauth header name (googleapis#2564)
Adds support for custom OAuth header and updates documentation.
## Description
> Should include a concise description of the changes (bug or feature),
it's
> impact, along with a summary of the solution
## PR Checklist
> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:
- [ ] Make sure you reviewed
[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [ ] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [ ] Make sure to add `!` if this involve a breaking change
🛠️ Fixes #<issue_number_goes_here>
Copy file name to clipboardExpand all lines: docs/en/resources/sources/bigquery.md
+10-5Lines changed: 10 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,10 +104,15 @@ Common scopes include `https://www.googleapis.com/auth/bigquery` or
104
104
### Authentication via User's OAuth Access Token
105
105
106
106
If the `useClientOAuth` parameter is set to `true`, Toolbox will instead use the
107
-
OAuth access token for authentication. This token is parsed from the
108
-
`Authorization` header passed in with the tool invocation request. This method
109
-
allows Toolbox to make queries to [BigQuery][bigquery-docs] on behalf of the
110
-
client or the end-user.
107
+
OAuth access token for authentication. By default, this token is parsed from the
108
+
`Authorization` header passed in with the tool invocation request.
109
+
110
+
If you need to use a non-standard header for the access token (e.g., to avoid
111
+
conflicts with other services like Cloud Run), you can specify the header name
112
+
in the `useClientOAuth` field (e.g., `useClientOAuth: X-BigQuery-Auth`).
113
+
114
+
This method allows Toolbox to make queries to [BigQuery][bigquery-docs] on behalf
115
+
of the client or the end-user.
111
116
112
117
When using this on-behalf-of authentication, you must ensure that the
113
118
identity used has been granted the correct IAM permissions.
@@ -166,7 +171,7 @@ useClientOAuth: true
166
171
| location | string | false | Specifies the location (e.g., 'us', 'asia-northeast1') in which to run the query job. This location must match the location of any tables referenced in the query. Defaults to the table's location or 'US' if the location cannot be determined. [Learn More](https://cloud.google.com/bigquery/docs/locations)|
167
172
| writeMode | string | false | Controls the write behavior for tools. `allowed` (default): All queries are permitted. `blocked`: Only `SELECT` statements are allowed for the `bigquery-execute-sql` tool. `protected`: Enables session-based execution where all tools associated with this source instance share the same [BigQuery session](https://cloud.google.com/bigquery/docs/sessions-intro). This allows for stateful operations using temporary tables (e.g., `CREATE TEMP TABLE`). For `bigquery-execute-sql`, `SELECT` statements can be used on all tables, but write operations are restricted to the session's temporary dataset. For tools like `bigquery-sql`, `bigquery-forecast`, and `bigquery-analyze-contribution`, the `writeMode` restrictions do not apply, but they will operate within the shared session. **Note:** The `protected` mode cannot be used with `useClientOAuth: true`. It is also not recommended for multi-user server environments, as all users would share the same session. A session is terminated automatically after 24 hours of inactivity or after 7 days, whichever comes first. A new session is created on the next request, and any temporary data from the previous session will be lost. |
168
173
| allowedDatasets |[]string | false | An optional list of dataset IDs that tools using this source are allowed to access. If provided, any tool operation attempting to access a dataset not in this list will be rejected. To enforce this, two types of operations are also disallowed: 1) Dataset-level operations (e.g., `CREATE SCHEMA`), and 2) operations where table access cannot be statically analyzed (e.g., `EXECUTE IMMEDIATE`, `CREATE PROCEDURE`). If a single dataset is provided, it will be treated as the default for prebuilt tools. |
169
-
| useClientOAuth | bool | false | If true, forwards the client's OAuth access token from the "Authorization" header to downstream queries. **Note:** This cannot be used with `writeMode: protected`. |
174
+
| useClientOAuth |string | false | If set to `'true'`, forwards the client's OAuth access token from the default `Authorization` header. If set to a custom header name (e.g., `X-My-Auth`), that header will be used instead. An empty string or `'false'` disables this feature. Defaults to `""` (disabled).|
170
175
| scopes |[]string | false | A list of OAuth 2.0 scopes to use for the credentials. If not provided, default scopes are used. |
171
176
| impersonateServiceAccount | string | false | Service account email to impersonate when making BigQuery and Dataplex API calls. The authenticated principal must have the `roles/iam.serviceAccountTokenCreator` role on the target service account. [Learn More](https://cloud.google.com/iam/docs/service-account-impersonation)|
172
177
| maxQueryResultRows | int | false | The maximum number of rows to return from a query. Defaults to 50. |
Copy file name to clipboardExpand all lines: docs/en/resources/sources/looker.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,7 +101,7 @@ instead of hardcoding your secrets into the configuration file.
101
101
| project | string | false | The project id to use in Google Cloud. |
102
102
| location | string | false | The location to use in Google Cloud. (default: us) |
103
103
| timeout | string | false | Maximum time to wait for query execution (e.g. "30s", "2m"). By default, 120s is applied. |
104
-
| use_client_oauth | string | false | Use OAuth tokens instead of client_id and client_secret. (default: false) If a header name is provided, it will be used instead of "Authorization". |
104
+
| use_client_oauth | string | false | If set to `'true'`, forwards the client's OAuth access token from the default `Authorization` header. If set to a custom header name (e.g., `X-Looker-Auth`), that header will be used instead. An empty string or `'false'` disables this feature. Defaults to `""` (disabled). |
105
105
| show_hidden_models | string | false | Show or hide hidden models. (default: true) |
106
106
| show_hidden_explores | string | false | Show or hide hidden explores. (default: true) |
107
107
| show_hidden_fields | string | false | Show or hide hidden fields. (default: true) |
0 commit comments