Validate an existing session token and return the user object
OAuth & Sessions
Validate Session
Protected route that returns the user object from the request body when the session is valid. Requires authentication and appropriate role middleware.
POST
Validate an existing session token and return the user object
Validate an existing session token and return the user object. Protected route that returns the user object from the request body when the session is valid. Requires authentication and appropriate role middleware.
Request
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token |
| Content-Type | string | Yes | application/json |
Request Body
Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
| user | object | Yes | User object to validate |
Response
200 OK - Session valid
Returns the user object.401 Unauthorized
500 Internal Server Error
Example
Notes
- This endpoint requires a valid JWT token in the Authorization header
- The request body should contain the user object you want to validate
- This is useful for checking if a session is still active and valid
- The endpoint validates both the token and the user object in the request body
- Use this to implement session refresh logic in your application