Skip to main content

JWT / Access Tokens

Issuer (iss rfc)

You can customize the iss property by setting the issuer property in the AuthorizationServer configuration.

Audience (aud rfc)

You can customize the aud field by passing aud.

EndpointQueryBody
/tokenaud | audienceaud | audience
/authorizeaud | audience

Extra Token Fields

You can add additional properties to the encoded access token by implementing the extraTokenFields method in your JwtService class.

import { JwtService } from "@jmondi/oauth2-server";

export class MyCustomJwtService extends JwtService {
extraTokenFields(params: ExtraAccessTokenFieldArgs) {
const { user = undefined, client } = params;
return {
email: user?.email,
myCustomProps: "this will be in the decoded token!",
};
}
}