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,
)
}Assign one or more existing user roles to a user. For more information, review Role-Based Access Control.
Note: New roles cannot be created through this action. Additionally, this action is used to assign roles to a user in the context of your whole tenant. To assign roles in the context of a specific Organization, use the following endpoint: Assign user roles to an Organization member.
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,
)
}Documentation Index
Fetch the complete documentation index at: https://auth0-chore-sdk-version-update-20260521.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
ID of the user to associate roles with.
List of roles IDs to associated with the user.
11Roles successfully associated with user.
このページは役に立ちましたか?