Hey all, I am trying to access the api to remove t...
# ory-selfhosting
s
Hey all, I am trying to access the api to remove the access token using htis api- but this is not working so can anyone help me with revoking access token api?
curl --location --request POST '<https://some_domain/oauth2/introspect?scope=revoke_token&token=5cjE7x53qToc-FnfCsg1KD1RIWDg4-cP3GgCipRt0peE.SGUie_jGhgnlpunErjg4kcfbSabHjhDwIhzMwH4dO_I>'
m
@steep-summer-29793 To revoke an access token, you should use the
/oauth2/revoke
endpoint, not the
/oauth2/introspect
endpoint. The introspect endpoint is used to get details about a token, not to revoke it. Here is an example of how to revoke a token using the Ory CLI:
Copy code
ory revoke token --client-id your-client-id --client-secret your-client-secret your-token
Replace
your-client-id
,
your-client-secret
, and
your-token
with your actual client ID, client secret, and the token you want to revoke. You can also use the Ory Hydra CLI:
Copy code
hydra revoke token --client-id your-client-id --client-secret your-client-secret your-token
Again, replace
your-client-id
,
your-client-secret
, and
your-token
with your actual values. If you want to use a HTTP request, you can use the
POST /oauth2/revoke
endpoint. Here is an example:
Copy code
curl --location --request POST '<https://your-domain/oauth2/revoke>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=your-client-id' \
--data-urlencode 'client_secret=your-client-secret' \
--data-urlencode 'token=your-token'
Replace
your-domain
,
your-client-id
,
your-client-secret
, and
your-token
with your actual values. Please note that you need to be authenticated to perform this operation. The authentication methods supported are basic and oauth2. For more details, please refer to the Ory API Reference and the Hydra API Reference.