Invalidate all sessions for a user
To invalidate (log out) all sessions for a user, send an HTTP POST request to the /json/sessions/
endpoint with the
logoutByUser
action, specifying the username in the request payload.
Use an access token as a bearer token in the Authorization
HTTP header.
This example logs out all sessions for user bjensen (whose universal ID is 1dff18dc-ac57-4388-8127-dff309f80002
):
$ curl \
--request POST \
--header "Content-Type: application/json" \
--header 'Authorization: Bearer <access-token>' \
--header "Accept-API-Version: resource=5.1, protocol=1.0" \
--data '{"username": "1dff18dc-ac57-4388-8127-dff309f80002"}' \
'https://<tenant-env-fqdn>/am/json/realms/root/realms/alpha/sessions/?_action=logoutByUser'
{
"result": true
}
- NOTE
-
This action is called on a specific realm.