Skip to main content

If you are using our backend SDK that is lesser than the following versions, please visit the older documentation link here.


You can use this as a standalone recipe, or alongside any of the other recipes provided by us. To get started, initialise the recipe in the backend SDK's init function call:

import SuperTokens from "supertokens-node";
import UserRoles from "supertokens-node/recipe/userroles";

supertokens: {
connectionURI: "..."
appInfo: {
apiDomain: "...",
appName: "...",
websiteDomain: "..."
recipeList: [

By default, the user roles recipe will add the roles and permission information into a user's session (if they have assigned roles & permissions). If you do not want roles or permissions information in the session, or want to manually add it yourself, you can provide the following input configs to the UserRoles.init function:

import UserRoles from "supertokens-node/recipe/userroles";

skipAddingRolesToAccessToken: true,
skipAddingPermissionsToAccessToken: true,
Looking for older versions of the documentation?
Which UI do you use?
Custom UI
Pre built UI