token variant
This commit is contained in:
@@ -10,11 +10,15 @@ Token has precedence over the service account:
|
||||
| Header | Meaning |
|
||||
| --- | --- |
|
||||
| `X-GA-Access-Token` | Ready OAuth2 access token, used directly as `Authorization: Bearer`. |
|
||||
| `Authorization` | Standard `Authorization: Bearer <token>` header — equivalent alternative to `X-GA-Access-Token`. |
|
||||
| `X-GA-Credentials` | **Base64** of a Google service-account JSON key. The proxy mints a short-lived token (scope `https://www.googleapis.com/auth/analytics.readonly`) via `google-auth` and caches it in memory until ~60 s before expiry. |
|
||||
| `X-GA-Quota-Project` | Optional GCP project id → upstream `x-goog-user-project`. |
|
||||
|
||||
At least one of `X-GA-Access-Token` / `X-GA-Credentials` is required (otherwise
|
||||
`401 missing_credentials`).
|
||||
A ready access token can be supplied either in `X-GA-Access-Token` or in the
|
||||
standard `Authorization: Bearer <token>` header. At least one credential source
|
||||
(token header, `Authorization: Bearer`, or `X-GA-Credentials`) is required,
|
||||
otherwise `401 missing_credentials`. Priority when several are present:
|
||||
`X-GA-Access-Token` → `Authorization: Bearer` → `X-GA-Credentials`.
|
||||
|
||||
The service account (or token) must have access to the GA4 property — add its
|
||||
`client_email` as a viewer in GA Admin → Property Access Management.
|
||||
|
||||
Reference in New Issue
Block a user