Passer au contenu principal
POST
/
users
/
{id}
/
roles
TypeScript
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.users.roles.assign("id", {
        roles: [
            "roles",
        ],
    });
}
main();

Autorisations

Authorization
string
header
requis

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Paramètres de chemin

id
string
requis

ID of the user to associate roles with.

Corps

roles
string[]
requis

List of roles IDs to associated with the user.

Minimum array length: 1
Minimum string length: 1

Réponse

Roles successfully associated with user.