feat(keycardai-oauth): support for impersonation token exchange#91
Merged
seriousben merged 1 commit intomainfrom Apr 2, 2026
Merged
feat(keycardai-oauth): support for impersonation token exchange#91seriousben merged 1 commit intomainfrom
seriousben merged 1 commit intomainfrom
Conversation
a75212c to
26d57d2
Compare
Larry-Osakwe
approved these changes
Apr 2, 2026
- Add substitute-user token type and unsigned JWT builder - Add impersonate method to Client and AsyncClient - Add user_identifier callback to MCP grant decorator - Add impersonation token exchange example
26d57d2 to
14a56e1
Compare
📦 Release PreviewThis analysis shows the expected release impact: 📈 Expected Version Changes📋 Package Details[
{
"package_name": "keycardai-oauth",
"package_dir": "packages/oauth",
"has_changes": true,
"current_version": "0.8.0",
"next_version": "0.9.0",
"increment": "MINOR"
}
]📝 Changelog PreviewThis comment was automatically generated by the release preview workflow. |
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.
Why
Background agents and service-to-service flows need to act on behalf of a user without the user being present. This requires impersonation via substitute-user token exchange, where the calling application identifies the user and Keycard issues a scoped resource token based on the user's prior consent.
What
SUBSTITUTE_USERtoken type (urn:keycard:params:oauth:token-type:substitute-user)build_substitute_user_tokento build unsigned JWTs with{"typ": "vnd.kc.su+jwt", "alg": "none"}impersonatemethod toClientandAsyncClientuser_identifiercallback parameter to the MCP@grantdecorator for impersonation flowspackages/oauth/examples/impersonation_token_exchange/)