:wave: Hey! Using Descope's JWT Template, for exch...
# ask-a-descoper
g
👋 Hey! Using Descope's JWT Template, for exchanging an access key for JWT claims. Is there a way to get the access key creator using a custom claim, like it's possible for getting
key.name
? Or does it require sending an http request to
/v1/auth/accesskey/exchange
?
n
Hello Gal, Currently, Descope’s Access Key JWT Templates enable you to add dynamic claims, such as a
key.name
, but they don’t include the access key creator automatically. To get that value, you’d need to call the
/v1/auth/accesskey/exchange
endpoint (or use the Management SDK’s exchange method) and pull the creator from the response before issuing your JWT. If you want it to appear inside the token automatically, you can define it as a custom claim in your template, which will be populated via your backend during the key exchange.
g
Thanks for answer! I'm not sure I follow, how can I set the key creator as a custom claim in my JWT template? When editing the JWT template on Descope's UI (Project -> JWT Templates), I am only presented with: •
key.name
•
key.project.permissions
•
key.project.roles
Anyways, when using the
/v1/auth/accesskey/exchange
API, what is the custom claim required to get the access key creator? couldn't find it in the docs
For context - I want to use the access key creator for audit logging.
r
Hey Gal, the "creator" is not a key you can set in the JWT template. I can either suggest you to log this when the access key is created (stream it, using audit connectors) or to file a feature request and we will add this to our backlog.
g
Can I use the
/v1/mgmt/accesskey/search
endpoint to get the access key creator email? currently it only returns the creator name, which is not unique enough for audit logging purposes
Copy code
"createdBy": "Chen Alon"
r
Yeah. Same concept, if it’s missing we can add it. Just need a feature request filed.
g
Got it, thanks for the help. created a FR for the custom claims.