POST {{NEXT_PUBLIC_API_BASE_URL}}/api/logout

Logout User

Logs out the currently authenticated user. The user needs to be logged in. Upon success, the user’s session will be destroyed.

Request Headers

  • Content-Type: application/json
  • X-CSRFToken: The CSRF token of the user

Request Body

None.

Responses

200

The user is successfully logged out.

Example:

{
  "message": "Logged out successfully!"
}

401

The user is not logged in.

Example:

{
  "message": "You need to be logged in",
  "error": "Some descriptive error message"
}

500

An error occurred during the logout process.

Example:

{
  "message": "Error logging out user",
  "error": "Some descriptive error message"
}
Last updated on