List all roles
You can fetch all the roles that you have created
- NodeJS
- GoLang
- Python
- cURL
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 UserRoles from "supertokens-node/recipe/userroles";
async function getAllRoles() {
const roles: string[] = (await UserRoles.getAllRoles()).roles;
}
import (
"github.com/supertokens/supertokens-golang/recipe/userroles"
)
func getAllRoles() {
response, err := userroles.GetAllRoles(nil)
if err != nil {
// TODO: Handle error
return
}
_ = response.OK.Roles
}
- Asyncio
- Syncio
from supertokens_python.recipe.userroles.asyncio import get_all_roles
async def create_role():
_ = (await get_all_roles()).roles
from supertokens_python.recipe.userroles.syncio import get_all_roles
def create_role():
_ = get_all_roles().roles
curl --location --request GET '/recipe/roles' \
--header 'api-key: '