Passer au contenu principal
POST
https://{tenantDomain}/api/v2
/
refresh-tokens
/
revoke
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new ManagementClient(
            token: "<token>"
        );

        await client.RefreshTokens.RevokeAsync(
            new RevokeRefreshTokensRequestContent()
        );
    }

}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.refreshtokens.requests.RevokeRefreshTokensRequestContent;

public class Example {
public static void main(String[] args) {
ManagementApi client = ManagementApi
.builder()
.token("<token>")
.build();

client.refreshTokens().revoke(
RevokeRefreshTokensRequestContent
.builder()
.build()
);
}
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\RefreshTokens\Requests\RevokeRefreshTokensRequestContent;

$client = new Management(
token: '<token>',
);
$client->refreshTokens->revoke(
new RevokeRefreshTokensRequestContent([]),
);
from auth0.management import ManagementClient

client = ManagementClient(
token="<token>",
)

client.refresh_tokens.revoke()
require "auth0"

client = Auth0::Management.new(token: "<token>")

client.refresh_tokens.revoke
curl --request POST \
--url https://{tenantDomain}/api/v2/refresh-tokens/revoke \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"<string>"
],
"user_id": "<string>",
"client_id": "<string>",
"audience": "<string>"
}
'
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ids: ['<string>'],
user_id: '<string>',
client_id: '<string>',
audience: '<string>'
})
};

fetch('https://{tenantDomain}/api/v2/refresh-tokens/revoke', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{tenantDomain}/api/v2/refresh-tokens/revoke"

payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ],\n \"user_id\": \"<string>\",\n \"client_id\": \"<string>\",\n \"audience\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}

Autorisations

Authorization
string
header
requis

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

Corps

Exactly one of the following combinations must be provided: ids (up to 100 token IDs); user_id; user_id + client_id; or user_id + client_id + audience. ids cannot be combined with user_id, client_id, or audience. audience requires both user_id and client_id. client_id alone is not allowed — it must be paired with user_id.

ids
string[]

Array of refresh token IDs to revoke. Limited to 100 at a time.

Minimum array length: 1
Required string length: 1 - 30
user_id
string<user-id>

Revoke all refresh tokens for this user.

Required string length: 1 - 300
client_id
string<client-id>

Revoke refresh tokens for this client. Must be paired with user_id; optionally narrowed further with audience.

Required string length: 1 - 64
audience
string

Resource server identifier (audience) to scope the revocation. Must be used with both user_id and client_id.

Required string length: 1 - 600

Réponse

Refresh token revocation request accepted.