feat(tokens): expose signed JWT on client token response#57
Merged
Conversation
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.
What
tokens.create()now surfaces the server-issued signed JWT astoken, alongside the existing opaqueapi_key.Why
The JWT carries the same authorization context as the opaque key but can be verified offline against the public JWKS, so gateways can authenticate client tokens by signature instead of round-tripping to a verify endpoint on every connection. The opaque
api_keyis unchanged and remains the default;tokenis optional and is simply omitted (None) when signing isn't available — so this is fully backward compatible.Usage
Note
Low Risk
Additive response field with optional parsing only; no request or auth flow changes in the SDK.
Overview
tokens.create()now returns an optionaltokenonCreateTokenResponse— a signed JWT from the API’stokenfield, alongside the unchanged opaqueapi_key.The client maps
data.get("token")into the model (defaults toNonewhen signing isn’t returned), so existing callers stay compatible. Docs and the create-token example note offline JWKS verification; tests cover missing vs present JWT in responses.Reviewed by Cursor Bugbot for commit 91ae552. Bugbot is set up for automated code reviews on this repo. Configure here.