メインコンテンツへスキップ
POST
https://{tenantDomain}/api/v2
/
users
/
{id}
/
roles
Go
package example

import (
    context "context"

    client "github.com/auth0/go-auth0/management/management/client"
    option "github.com/auth0/go-auth0/management/management/option"
    users "github.com/auth0/go-auth0/management/management/users"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &users.AssignUserRolesRequestContent{
        Roles: []string{
            "roles",
        },
    }
    client.Users.Roles.Assign(
        context.TODO(),
        "id",
        request,
    )
}

承認

Authorization
string
header
必須

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

パスパラメータ

id
string
必須

ID of the user to associate roles with.

ボディ

roles
string[]
必須

List of roles IDs to associated with the user.

Minimum array length: 1
Minimum string length: 1

レスポンス

Roles successfully associated with user.