Logout a User API

On this page

The Logout API is intended to be used to remove the refresh token and access token cookies if they exist on the client and revoke the refresh token. This API does nothing if the request does not contain an access token or refresh token cookies.

The refresh token is only revoked if the request contains the refresh_token cookie or the refreshToken request parameter.

Request#

Send the access token and refresh token cookies to remove, or the refresh token as a request parameter.

No Authentication Required
Remove the access_token and refresh_token cookies if they exist on the client.
POST/api/logout
OpenAPI Spec

Request Cookies#

access_token
  • Type: String
  • Optional

The access token cookie. When this cookie available in the request it will be deleted from the client.

refresh_token
  • Type: String
  • Optional

The refresh token cookie. When this cookie available in the request it will be deleted from the client and revoked in FusionAuth.

Request Headers#

X-FusionAuth-TenantId
  • Type: String
  • Optional

The unique Id of the tenant used to scope this API request.

The tenant Id is not required on this request even when more than one tenant has been configured because the tenant can be identified based upon other values in the request or it is otherwise not required.

Specify a tenant Id on this request when you want to ensure the request is scoped to a specific tenant. The tenant Id may be provided through this header or by using a tenant locked API key to achieve the same result.

See Making an API request using a Tenant Id for additional information.

Request Body#

eventInfo
  • Type: Object
  • Optional

Information about the request. FusionAuth adds the information to the events the request triggers, as event.info. For more information, see Pass Context From API Requests to Webhooks.

eventInfo.data
  • Type: Object
  • Optional

An object that holds any JSON you choose, such as a trace Id. FusionAuth copies the object to event.info.data without changes.

eventInfo.deviceDescription
  • Type: String
  • Optional

A description of the end user's device.

eventInfo.deviceName
  • Type: String
  • Optional

The name of the end user's device.

eventInfo.deviceType
  • Type: String
  • Optional

The type of the end user's device.

eventInfo.ipAddress
  • Type: String
  • Optional

The IP address of the end user. When your server calls FusionAuth for the end user, set this value to the end user's IP address. When this value is omitted, FusionAuth uses the IP address of the client that sent the request.

eventInfo.os
  • Type: String
  • Optional

The operating system of the end user's device.

eventInfo.userAgent
  • Type: String
  • Optional

The user agent of the end user's browser.

global
  • Type: Boolean
  • Optional
  • Defaults to false

When this value is set to true, revokes:

  • all of the refresh tokens issued to the owner of the provided refresh token
  • the FusionAuth SSO session

If no refresh token is provided on the request, no refresh tokens will be revoked.

refreshToken
  • Type: String
  • Optional

The refresh token to revoke.

If provided, FusionAuth uses the token provided in this parameter instead of the token provided in the refresh_token cookie.

Response#

This API does not return a JSON response body.

Response Codes
CodeDescription
200

The update was successful.

500

There was an internal error. A stack trace is provided and logged in the FusionAuth log files.