Logout the current user
OAuth & Sessions
Logout
Logs out the currently authenticated user by invalidating their session token. Requires a valid authentication token. After calling this endpoint remove the user data from the client.
POST
Logout the current user
Logout the current user by invalidating their session token. Requires a valid authentication token. After calling this endpoint remove the user data from the client.
Request
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token |
Response
200 OK - Successfully logged out
401 Unauthorized
500 Internal Server Error
Example
Notes
- This endpoint requires a valid JWT token in the Authorization header
- The server will invalidate the session token, making it unusable for future requests
- After successful logout, remove all user data from client-side storage
- Clear any stored tokens, user information, or session data from your application
- The response includes a personalized message with the user’s name
- This is the recommended way to properly log out users from the system
Client-side Implementation
After calling this endpoint, you should:- Remove the JWT token from storage (localStorage, sessionStorage, cookies)
- Clear user data from your application state
- Redirect the user to the login page
- Clear any cached data that requires authentication