Skip to content

Authentication

Base path: `/api/auth`

Register

Create a new user account.

  • Method: `POST`
  • Endpoint: `/register`
  • Body: ```json { "email": "user@example.com", "password": "securepassword", "full_name": "John Doe", "username": "johndoe" } ```

Login

Login with email and password.

  • Method: `POST`
  • Endpoint: `/login`
  • Body: ```json { "email": "user@example.com", "password": "securepassword" } ```
  • Response: Returns user object, access_token, and refresh_token.

Google Login

Login or register via Google OAuth.

  • Method: `POST`
  • Endpoint: `/google/login`
  • Body: ```json { "id_token": "GOOGLE_ID_TOKEN" } ```

Logout

Invalidate sessions.

  • Method: `POST`
  • Endpoint: `/logout`
  • Headers: `Authorization: Bearer YOUR_TOKEN`
  • Body (Optional): ```json { "refresh_token": "YOUR_REFRESH_TOKEN" } ``` If provided, only that session is invalidated. Otherwise, all sessions.

Refresh Token

Get a new access token.

  • Method: `POST`
  • Endpoint: `/refresh-token`
  • Body: ```json { "refresh_token": "YOUR_REFRESH_TOKEN" } ```

Password Reset

Forgot Password

  • Method: `POST`
  • Endpoint: `/forgot-password`
  • Body: {"email": "..."}

Reset Password

  • Method: `POST`
  • Endpoint: `/reset-password`
  • Body: {"token": "...", "password": "..."}