Skip to content

Support service account tokens with domain-wide delegation in the Google emulator - #405

Closed
jychp wants to merge 4 commits into
vercel-labs:mainfrom
Unchallenged-com:google-service-account-delegation
Closed

jychp wants to merge 4 commits into
vercel-labs:mainfrom
Unchallenged-com:google-service-account-delegation

Conversation

@jychp

@jychp jychp commented Nov 13, 2026

Copy link
Copy Markdown
  • The token endpoint accepts the JWT bearer grant of service accounts seeded with their public keys (google.service_accounts), and with sub issues a token acting as that user when google.domain_wide_delegation grants every requested scope.
  • Signatures, key IDs, the 65-minute assertion limit, scopes, unknown users, and delegation refusals (unauthorized_client for a client without delegation, access_denied for a scope it does not grant) answer as Google's error table lists; the other grants and the permissive default are unchanged, covered by service-account-delegation.test.ts and documented in the README, docs page, skill, and CLI help.
  • Undocumented details follow responses observed from Google (401 for unauthorized_client, 403 with "Requested client not authorized." for access_denied) and are otherwise choices listed in the issue (400 for the remaining errors, the wrong-audience message, the two legacy audiences, five minutes of clock skew).

References:

Fixes #404

…gle emulator

- The token endpoint accepts the JWT bearer grant of service accounts seeded with their public keys, and with sub issues a token acting as a user when domain-wide delegation grants every requested scope.
- Signatures, key IDs, lifetimes, scopes and unknown accounts or users are checked with Google's errors, and the other grants are unchanged; covered by tests and documented.
- A service account whose client ID has no domain-wide delegation now gets `unauthorized_client` "Unauthorized client or scope in request.", and one missing a requested scope gets `access_denied`, as Google's JWT error table lists them.
- The CLI help describes the JWT bearer grant like the README, docs page, and skill; the other errors are unchanged, with a test for each refusal.
- `access_denied` for a scope the delegation does not grant now answers `400`, RFC 6749's default for token errors, since Google documents no status and no captured response shows one.
- `unauthorized_client` for a client without delegation keeps `401`, the status Google returns for it in captured responses; the test asserts both.
- `access_denied` for a scope the delegation does not grant now answers `403`, the status Google returns for it in a captured response.
- `unauthorized_client` keeps `401`, and the other errors `400`; the test asserts the new status.
@jychp

jychp commented Nov 13, 2026

Copy link
Copy Markdown
Author

Note on the commit "Answer missing delegated scopes with the OAuth default status": its message says no captured response shows a status for access_denied, which is wrong. One does, with 403, and the follow-up commit uses it.

@vercel

vercel Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

@jychp is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@jychp

jychp commented Nov 16, 2026

Copy link
Copy Markdown
Author

Superseded by #406.

@jychp jychp closed this Nov 16, 2026
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.

Google: the token endpoint does not accept service account assertions

1 participant