C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Users;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementClient(
token: "<token>"
);
await client.Users.Roles.DeleteAsync(
id: "id",
request: new DeleteUserRolesRequestContent {
Roles = new List<string>(){
"roles",
}
}
);
}
}
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.DeleteUserRolesRequestContent{
Roles: []string{
"roles",
},
}
client.Users.Roles.Delete(
context.TODO(),
"id",
request,
)
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.users.roles.requests.DeleteUserRolesRequestContent;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.token("<token>")
.build();
client.users().roles().delete(
"id",
DeleteUserRolesRequestContent
.builder()
.roles(
Arrays.asList("roles")
)
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Users\Roles\Requests\DeleteUserRolesRequestContent;
$client = new Management(
token: '<token>',
);
$client->users->roles->delete(
'id',
new DeleteUserRolesRequestContent([
'roles' => [
'roles',
],
]),
);
from auth0.management import ManagementClient
client = ManagementClient(
token="<token>",
)
client.users.roles.delete(
id="id",
roles=[
"roles"
],
)
require "auth0"
client = Auth0::Management.new(token: "<token>")
client.users.roles.delete(
id: "id",
roles: ["roles"]
)
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.users.roles.delete("id", {
roles: [
"roles",
],
});
}
main();
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.users.roles.delete("id", {
roles: [
"roles",
],
});
}
main();
curl --request DELETE \
--url https://{tenantDomain}/api/v2/users/{id}/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"roles": [
"<string>"
]
}
'Removes roles from a user
Remove one or more specified user roles assigned to a user.
Note: This action removes a role from a user in the context of your whole tenant. If you want to unassign a role from a user in the context of a specific Organization, use the following endpoint: Delete user roles from an Organization member.
DELETE
https://{tenantDomain}/api/v2
/
users
/
{id}
/
roles
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Users;
using System.Collections.Generic;
public partial class Examples
{
public async Task Example() {
var client = new ManagementClient(
token: "<token>"
);
await client.Users.Roles.DeleteAsync(
id: "id",
request: new DeleteUserRolesRequestContent {
Roles = new List<string>(){
"roles",
}
}
);
}
}
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.DeleteUserRolesRequestContent{
Roles: []string{
"roles",
},
}
client.Users.Roles.Delete(
context.TODO(),
"id",
request,
)
}
package com.example.usage;
import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.users.roles.requests.DeleteUserRolesRequestContent;
import java.util.Arrays;
public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.token("<token>")
.build();
client.users().roles().delete(
"id",
DeleteUserRolesRequestContent
.builder()
.roles(
Arrays.asList("roles")
)
.build()
);
}
}<?php
namespace Example;
use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Users\Roles\Requests\DeleteUserRolesRequestContent;
$client = new Management(
token: '<token>',
);
$client->users->roles->delete(
'id',
new DeleteUserRolesRequestContent([
'roles' => [
'roles',
],
]),
);
from auth0.management import ManagementClient
client = ManagementClient(
token="<token>",
)
client.users.roles.delete(
id="id",
roles=[
"roles"
],
)
require "auth0"
client = Auth0::Management.new(token: "<token>")
client.users.roles.delete(
id: "id",
roles: ["roles"]
)
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.users.roles.delete("id", {
roles: [
"roles",
],
});
}
main();
import { ManagementClient } from "auth0";
async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.users.roles.delete("id", {
roles: [
"roles",
],
});
}
main();
curl --request DELETE \
--url https://{tenantDomain}/api/v2/users/{id}/roles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"roles": [
"<string>"
]
}
'Autorisations
bearerAuthoAuth2ClientCredentials
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Paramètres de chemin
ID of the user to remove roles from.
Corps
application/jsonapplication/x-www-form-urlencoded
List of roles IDs to remove from the user.
Minimum array length:
1Minimum string length:
1Réponse
Users roles successfully removed.
Cette page vous a-t-elle été utile ?
⌘I