Auth API Documentation

FastAPI-based Authentication System

Base URL: http://127.0.0.1:8080

1. Register User

POST /auth/register

Create a new user account.

import httpx

async def register():
    async with httpx.AsyncClient() as client:
        response = await client.post("http://127.0.0.1:8080/auth/register", json={
            "fullname": "John Doe",
            "email": "john@example.com",
            "password": "yourpassword",
            "gender": "male",
            "dob": "1995-05-10"
        })
        print(response.json())

2. Login

POST /auth/login

Generate access and refresh tokens.

import httpx

async def login():
    async with httpx.AsyncClient() as client:
        response = await client.post("http://127.0.0.1:8080/auth/login", data={
            "username": "john@example.com",
            "password": "yourpassword"
        })
        print(response.json())

3. Refresh Token

POST /auth/refresh

import httpx

async def refresh_token(refresh_token: str):
    async with httpx.AsyncClient() as client:
        response = await client.post("http://127.0.0.1:8080/auth/refresh", json={
            "refresh_token": refresh_token
        })
        print(response.json())

4. Logout

POST /auth/logout

import httpx

async def logout(refresh_token: str):
    async with httpx.AsyncClient() as client:
        response = await client.post("http://127.0.0.1:8080/auth/logout", json={
            "refresh_token": refresh_token
        })
        print(response.json())