Bindings overview
Workflows
The kinde.accessToken
binding lets you modify access tokens for the current user. When you add custom claims, they are included in the access token returned to the client.
setCustomClaim(name: string, value: any): void
Adds a custom claim to the access token. The claim will be available when the token is returned to the client.
export const workflowSettings = { // ...other settings bindings: {"kinde.accessToken": {}}};
The Kinde infrastructure library provides type-safe access token modification:
import { accessTokenCustomClaims } from "@kinde/infrastructure";
export default async function (event: onUserTokenGeneratedEvent) { const accessToken = accessTokenCustomClaims<{ hello: string; ipAddress: string; }>();
accessToken.hello = "Hello there!"; accessToken.ipAddress = event.request.ip;};
If you’re not using the infrastructure library, you can modify the access token directly:
kinde.accessToken.setCustomClaim("hello", "Hello there!");kinde.accessToken.setCustomClaim("ipAddress", event.request.ip);