🚀 Usage Guide
This guide walks you through using the JANUX Authentication Gateway, to authenticate users and managing JWT tokens.
Once running, the API is available at:
Check if the service is live:
Expected response:
🔑 Authenticating Users
➊ Register a New User
To register a new user, send a POST request to /users/register:
curl -X POST http://localhost:8000/users/register \
-H "Content-Type: application/json" \
-d '{
"email": "test.user@example.com",
"full_name": "Test User",
"password": "Passw0rd123!"
}'
Expected response:
➋ Logging In
To authenticate, send user credentials to /auth/login:
curl -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=test.user@example.com&password=Passw0rd123!"
Successful login response:
🔐 Using JWT Tokens
Once logged in, use the access token for authentication in API requests. Example of calling a protected route:
🎫 Managing Admin Accounts
➊ Create a Super Admin (First-Time Setup)
To create a super admin account:
curl -X POST http://localhost:8000/admins/create \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com",
"full_name": "Admin User",
"password": "SecureAdminPass123!",
"role": "super_admin"
}'
➋ Logging in as an Admin
Use the same login endpoint /auth/login but with admin credentials.
curl -X POST http://localhost:8000/auth/login \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin@example.com&password=SecureAdminPass123!"
🔄 Refreshing JWT Tokens
If enabled, a refresh token can be used to get a new access token.
📛 Revoking Tokens (Logout)
To invalidate a token and log out:
📂 API Documentation
Interactive API documentation is available at: