Skip to main content

Authentication

The Authentication API is used for user signup, login, token refresh, and getting the currently logged-in user.

Backend folder:

app/auth/

Endpoints

MethodEndpointDescription
POST/auth/signupCreate a new user account
POST/auth/loginLogin user and receive access token
POST/auth/refreshRefresh expired access token
GET/auth/users/meGet current logged-in user

Signup

POST /auth/signup

Creates a new user account.

Request Body Example

{
"email": "[email protected]",
"password": "password123",
"full_name": "Admin User"
}

Possible Responses

Status CodeMeaning
200User created successfully
400Invalid request data
409User already exists

Login

POST /auth/login

Logs in a user and returns an authentication token.

Request Body Example

{
"email": "[email protected]",
"password": "password123"
}

Response Example

{
"access_token": "jwt_token_here",
"token_type": "bearer"
}

Refresh Token

POST /auth/refresh

Creates a new access token using a refresh token.

Possible Responses

Status CodeMeaning
200Token refreshed successfully
401Invalid or expired refresh token

Get Current User

GET /auth/users/me

Returns information about the currently logged-in user.

Required Header

Authorization: Bearer YOUR_ACCESS_TOKEN

Possible Responses

Status CodeMeaning
200Current user returned successfully
401User is not authenticated