Passer au contenu principal
GET
https://{tenantDomain}/api/v2
/
users
/
{id}
/
permissions
Go
package example

import (
    context "context"

    management "github.com/auth0/go-auth0/management/management"
    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.ListUserPermissionsRequestParameters{
        PerPage: management.Int(
            1,
        ),
        Page: management.Int(
            1,
        ),
        IncludeTotals: management.Bool(
            true,
        ),
    }
    client.Users.Permissions.List(
        context.TODO(),
        "id",
        request,
    )
}
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.users.permissions.list("id", {
perPage: 1,
page: 1,
includeTotals: true,
});
}
main();
import { ManagementClient } from "auth0";

async function main() {
const client = new ManagementClient({
token: "<token>",
});
await client.users.permissions.list("id", {
perPage: 1,
page: 1,
includeTotals: true,
});
}
main();
curl --request GET \
--url https://{tenantDomain}/api/v2/users/{id}/permissions \
--header 'Authorization: Bearer <token>'
import requests

url = "https://{tenantDomain}/api/v2/users/{id}/permissions"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://{tenantDomain}/api/v2/users/{id}/permissions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
HttpResponse<String> response = Unirest.get("https://{tenantDomain}/api/v2/users/{id}/permissions")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{tenantDomain}/api/v2/users/{id}/permissions")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
[
  {
    "sources": "<unknown>",
    "resource_server_identifier": "<string>",
    "permission_name": "<string>",
    "resource_server_name": "<string>",
    "description": "<string>"
  }
]

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 retrieve the permissions for.

Paramètres de requête

per_page
integer

Number of results per page.

Plage requise: 1 <= x <= 100
page
integer

Page index of the results to return. First page is 0.

Plage requise: x >= 0
include_totals
boolean

Return results inside an object that contains the total result count (true) or as a direct array of results (false, default).

Réponse

Permissions successfully retrieved.

sources
any
resource_server_identifier
string

Resource server (API) identifier that this permission is for.

permission_name
string

Name of this permission.

resource_server_name
string

Resource server (API) name this permission is for.

description
string

Description of this permission.