Repository navigation
auth: add optional ID token to authenticate - #631
Merged
Merged
Conversation
Extend authenticate with an optional idToken, the OpenID Connect ID Token issued with the access token, so a host can read identity claims that the opaque access token and the opaque accountId do not expose. Document that it is not a bearer credential and that its claims are unverified. Regenerate native models and schemas, and cover the field in schema validation and a shared round-trip fixture. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TylerLeonhardt
marked this pull request as ready for review
November 25, 2026 19:02
TylerLeonhardt
requested review from
Connor Peet (connor4312) and
roblourens
as code owners
November 25, 2026 19:02
TylerLeonhardt
enabled auto-merge (squash)
November 25, 2026 19:04
State the purpose of idToken first, and keep only the host rule specific to AHP: it is client-supplied account information, not a credential. Drop the points an OpenID Connect consumer already knows and the notes that apply to any optional field. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Connor Peet (connor4312)
previously approved these changes
Nov 25, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TylerLeonhardt
dismissed
Connor Peet (connor4312)’s stale review
via
November 25, 2026 19:55
78aa0de
Connor Peet (connor4312)
approved these changes
Nov 25, 2026
roblourens
approved these changes
Nov 25, 2026
Wing K.Y (wingwkyuen)
pushed a commit
to tcgoidc/vscode
that referenced
this pull request
Nov 26, 2026
…icrosoft#350464) * agentHost: forward the authentication ID token and learn the tenant Forward the Microsoft session's ID token on authenticate, using the optional idToken field from microsoft/agent-host-protocol#631. The host keeps it with the accepted credential, replays it, and redacts it from AHP logs. The Entra bridge reads the unverified tid claim from the first ID token sent for the account and keeps it with the account. Nothing is handed to the runtime yet: the identity result that carries the tenant is left as a TODO until the SDK accepts it. Sync the protocol copy with idToken as a targeted backport on the current pin. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: keep the ID token off sealed connections and track the accepted credential Drop the ID token wherever the access token is sealed, since only the token can be sealed and a relay would otherwise read its claims. Learn the tenant from the discovery credential that was just accepted, not from an older credential stored under the advertised scopes. Include the ID token in the client's forwarded-credential key, so one that becomes available for an unchanged access token still reaches the host. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: send the ID token on relayed connections too Stop dropping the ID token where the access token is sealed. An optional field that is silently omitted on one kind of connection is hard to notice, and the relay already carries the session's content in clear; the ID token is identity, not access. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * agentHost: simplify ID token handling after review Move authenticate redaction into one function so the log replacer does not grow, share the nonempty-string check between accountId and idToken, and store the ID token the same way as the account ID. Stop storing the ID token on host execution credentials, where nothing can read it, and keep the authority type private to the bridge. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an optional
AuthenticateParams.idToken: the OpenID Connect ID Token that the authorization server issued with the access token, forwarded unchanged. It mirrorsid_tokenin a token response, the same wayexpiresInmirrorsexpires_in.A host sometimes needs an identity claim about the account behind a token, such as its issuer or tenant. Today it has no standard way to get one:
scopesalready exists so that hosts do not decode it.accountId(auth: add optional account-selection hint #583) is opaque by definition, so a host must not parse it.The ID Token is the artifact that is meant to be read. VS Code's agent host needs the Microsoft Entra tenant of the signed-in account for one of its agent providers, and would otherwise have to carry it in private metadata.
Protocol delta
AuthenticateParamsidToken: string, nonempty when present.No capability, protocol-version change, new command, action or error. Older hosts ignore the field, and newer hosts keep accepting requests that omit it.
Semantics
The ID Token is client-supplied information about the account, not a credential. Hosts MUST NOT use it to authorize access, and its claims are unverified unless the host validates the token.
Open questions
ProtectedResourceMetadata, instead?account: { authority, id }. It does not carry tenant or other claims, so the two are complementary, but they should be reviewed together.This PR and #607 both add a field after
accountId, so whichever merges second needs a trivial rebase.Validation
npm run generate— passed, with no further changes on a second run.npm test— passed: 694 tests, including typecheck, lint, fragment and generated-output checks, schema tests and reducer coverage.go test -count=1 ./...inclients/go— passed.cargo test --workspaceinclients/rust— passed.