Paid Feature
This is a paid feature.
You can click on the Enable Paid Features button on our dashboard, and follow the steps from there on. Once enabled, this feature is free on the provided development environment.
Add custom claims in the tokens
If you want to add custom properties in the token payloads you can do this by using overrides
#
Override the OAuth2 Access Token- NodeJS
- GoLang
- Python
- Other Frameworks
Important
For other backend frameworks, you can follow our guide on how to spin up a separate server configured with the SuperTokens backend SDK to authenticate requests and issue session tokens.
import OAuth2Provider from "supertokens-node/recipe/oauth2provider";
OAuth2Provider.init({
override: {
functions: (originalImplementation) => ({
...originalImplementation,
buildAccessTokenPayload: async (input) => {
const addedInfo: Record<string, any> = {};
if (input.scopes.includes("profile")) {
addedInfo.profile = "custom-value";
}
return {
...(await originalImplementation.buildAccessTokenPayload(input)),
...addedInfo,
};
},
}),
},
});
caution
At the moment we do not have support creating OAuth2 providers in the Go SDK.
caution
At the moment we do not have support creating OAuth2 providers in the Python SDK.
#
Override the ID Token- NodeJS
- GoLang
- Python
- Other Frameworks
Important
For other backend frameworks, you can follow our guide on how to spin up a separate server configured with the SuperTokens backend SDK to authenticate requests and issue session tokens.
import OAuth2Provider from "supertokens-node/recipe/oauth2provider";
OAuth2Provider.init({
override: {
functions: (originalImplementation) => ({
...originalImplementation,
buildIdTokenPayload: async (input) => {
const addedInfo: Record<string, any> = {};
if (input.scopes.includes("profile")) {
addedInfo.profile = "custom-value";
}
return {
...(await originalImplementation.buildIdTokenPayload(input)),
...addedInfo,
};
},
}),
},
});
caution
At the moment we do not have support creating OAuth2 providers in the Go SDK.
caution
At the moment we do not have support creating OAuth2 providers in the Python SDK.