Skip to content

Access Token

Optional Claims

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.

/tokenaud | audienceaud | audience
/authorizeaud | audience

Implementing extraTokenFields

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!",

Released under the MIT License.