Repository navigation
Conversation
Resource token exchange posted to /oauth2/v1/token without client auth. Descope serves agentic token exchange only on the inbound-apps server (/oauth2/v1/apps/token, per /v1/apps/<projectId> discovery) and requires the exchanging client to authenticate; that client becomes act.sub. - Send the exchange to /oauth2/v1/apps/token with client_id/client_secret from the configured provider (ClientCredentialsProvider, or CibaProvider with a secret) - Fail fast, before any request or approval prompt, when the provider has no confidential client to authenticate the exchange - Key the Resource token cache by a SHA-256 of act_as_user_token so a shared client never serves one user's token to another (or to the agent) - Acquire and refresh ClientCredentialsProvider tokens on /oauth2/v1/apps/token, the Agentic Client token endpoint - Same changes in Python and TypeScript Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🐕 Shuni ReviewNo new issues found. 🤖 Model: Review scope: Partial incremental re-review Reviewed new changes (13)
🐕 Review complete — View session on Shuni Portal 🐾 🤖 Model: |
…ange tokens Address review on #47: - Key the Resource token cache by the authenticating client_id (act.sub) plus a SHA-256 of the subject token actually exchanged (the user's act_as_user_token or the phase-1 credential). The constant "agent" bucket let two clients, or two CIBA login_hints, share a token on a shared TokenStore. The subject is now resolved before the cache lookup. - Redact subject_token, actor_token and client_assertion in debug logs; a user's JWT on the act_as_user_token path was logged in clear text. - Docs: Resource tokens need a ClientCredentialsProvider client with act_as_user_token per call; AccessTokenProvider raises AgentAuthError. Updated README, AGENTS.md, quickstart and the AccessTokenProvider docstrings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Description
Resource token exchange (
resources.get_token/getToken) could not work against Descope, so an agent could not act on behalf of a user. It also cached user-scoped tokens without the user in the key, so one shared agent client could hand user A's Resource token to user B.Checked against a live project's discovery documents and the token endpoints:
/v1/apps/<projectId>/.well-known/openid-configurationliststoken_endpoint: /oauth2/v1/apps/token, withtoken-exchangeandclient_credentialsamong its grant types./oauth2/v1/apps/tokenrejects a token exchange without client authentication (E074130 Invalid client id)./oauth2/v1/token(what the SDK used) doesn't resolve Agentic Client IDs (E071001 Project does not exist).In a Nutshell
/oauth2/v1/apps/tokenwithclient_id+client_secret, so the minted token hasact.sub= the agenttoken_exchange_client_auth()/tokenExchangeClientAuth():ClientCredentialsProviderandCibaProvider(with a secret) supply client auth, and other providers return noneAccessTokenProvideralone)act_as_user_token(the raw token never goes in a store key), so users and the agent each get their own entryClientCredentialsProvidernow acquires and refreshes on/oauth2/v1/apps/tokenBehaviour changes
resources.get_tokenon a client built with onlyAccessTokenProvidernow raisesAgentAuthErrorinstead of sending a request. Descope would reject that request anyway. Use aClientCredentialsProviderclient withact_as_user_token.ClientCredentialsProvidermoves from/oauth2/v1/tokento/oauth2/v1/apps/token. This rests on the discovery document and the endpoint probes; it hasn't been run end to end with a real Agentic Client yet.Must
🤖 Generated with Claude Code