Skip to main content

Custom Grant ⚠️

To implement a custom grant, you may extend the AbstractGrant class.

warning

This is advanced usage. Make sure you understand the OAuth2.0 specification before implementing a custom grant.

Enable this grant
const customGrant = new MyCustomGrant(...);

authorizationServer.enableGrantTypes(
["client_credentials", new DateInterval("1d")],
[customGrant, new DateInterval("1d")],
);

Extending the CustomGrant class

Once you've implemented your custom grant you need to enable it in your AuthorizationServer.

export class MyCustomGrant extends CustomGrant {
readonly identifier = "custom:my_custom_grant";

... // Implement required methods
}