Documentation Index Fetch the complete documentation index at: https://mintlify.com/InsForge/InsForge/llms.txt
Use this file to discover all available pages before exploring further.
The Authentication API provides secure user authentication with support for email/password registration, OAuth providers, email verification, password resets, and session management.
Base URL
All authentication endpoints are prefixed with /api/auth
Public Configuration
Get Public Auth Config
GET /api/auth/public-config
curl https://your-app.region.insforge.app/api/auth/public-config
Retrieve public authentication configuration including OAuth providers and password requirements.
Response
List of configured OAuth providers OAuth provider name (google, github, discord, linkedin, facebook, instagram, tiktok, apple, x, spotify, microsoft)
Whether using InsForge shared OAuth keys
Whether email verification is required before login
Minimum password length (4-128)
Whether passwords must contain a number
Whether passwords must contain lowercase letters
Whether passwords must contain uppercase letters
Whether passwords must contain special characters
Email verification method: code (6-digit OTP) or link (magic link)
Password reset method: code (6-digit OTP + exchange) or link (magic link)
{
"oAuthProviders" : [
{
"provider" : "google" ,
"useSharedKey" : true
},
{
"provider" : "github" ,
"useSharedKey" : false
}
],
"requireEmailVerification" : true ,
"passwordMinLength" : 8 ,
"requireNumber" : true ,
"requireLowercase" : true ,
"requireUppercase" : false ,
"requireSpecialChar" : false ,
"verifyEmailMethod" : "code" ,
"resetPasswordMethod" : "link"
}
User Registration & Login
Register New User
curl -X POST https://your-app.region.insforge.app/api/auth/users?client_type=web \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securePassword123",
"name": "John Doe"
}'
Create a new user account with email and password.
Query Parameters
Client type determines token delivery:
web: Refresh token in httpOnly cookie, csrfToken in response
mobile/desktop: refreshToken in response body
Body Parameters
Password meeting configured requirements
Response
User object with profile information
JWT authentication token (null if email verification required)
CSRF token for refresh endpoint (web clients only)
Refresh token (mobile/desktop clients only)
Whether email verification is required before login
Email Verification Required
Registration Complete (No Verification)
{
"user" : {
"id" : "550e8400-e29b-41d4-a716-446655440000" ,
"email" : "user@example.com" ,
"profile" : {
"name" : "John Doe"
},
"emailVerified" : false ,
"providers" : [ "email" ],
"createdAt" : "2024-01-15T10:30:00Z"
},
"accessToken" : null ,
"csrfToken" : null ,
"refreshToken" : null ,
"requireEmailVerification" : true
}
User Login
curl -X POST https://your-app.region.insforge.app/api/auth/sessions?client_type=web \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "securePassword123"
}'
Authenticate user and return access token.
Query Parameters
Client type: web, mobile, or desktop
Body Parameters
Response
User object with profile information
CSRF token (web clients only)
Refresh token (mobile/desktop clients only)
Optional URL to redirect after login
{
"user" : {
"id" : "550e8400-e29b-41d4-a716-446655440000" ,
"email" : "user@example.com" ,
"profile" : {
"name" : "John Doe" ,
"avatar_url" : "https://example.com/avatar.jpg"
},
"emailVerified" : true ,
"providers" : [ "email" ],
"createdAt" : "2024-01-15T10:30:00Z"
},
"accessToken" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ,
"csrfToken" : "abc123def456"
}
Refresh Access Token
POST /api/auth/refresh (Web)
POST /api/auth/refresh (Mobile/Desktop)
curl -X POST https://your-app.region.insforge.app/api/auth/refresh?client_type=web \
-H "X-CSRF-Token: abc123def456" \
-H "Cookie: refreshToken=..." \
-H "Content-Type: application/json"
Refresh access token using refresh token.
Query Parameters
Client type: web (uses cookie + CSRF), mobile/desktop (uses body)
Headers (Web clients only)
CSRF token from login/register response
Body Parameters (Mobile/Desktop only)
Refresh token from previous authentication
Response
New CSRF token (web clients)
New refresh token (mobile/desktop clients - must replace old token)
Logout
curl -X POST https://your-app.region.insforge.app/api/auth/logout
Logout user and clear refresh token cookie.
Response
{
"success" : true ,
"message" : "Logged out successfully"
}
Get Current User
GET /api/auth/sessions/current
curl https://your-app.region.insforge.app/api/auth/sessions/current \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
Get currently authenticated user info from JWT token.
Response
{
"user" : {
"id" : "550e8400-e29b-41d4-a716-446655440000" ,
"email" : "user@example.com" ,
"role" : "authenticated"
}
}
Email Verification
Send Verification Email
POST /api/auth/email/send-verification
curl -X POST https://your-app.region.insforge.app/api/auth/email/send-verification \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com"
}'
Send email verification code or link based on configuration.
Body Parameters
Response
{
"success" : true ,
"message" : "If your email is registered, we have sent you a verification code. Please check your inbox."
}
Verify Email
POST /api/auth/email/verify (Code)
POST /api/auth/email/verify (Link)
curl -X POST https://your-app.region.insforge.app/api/auth/email/verify?client_type=web \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"otp": "123456"
}'
Verify email with code or token.
Body Parameters
Email address (required for code verification, omit for link verification)
6-digit code or 64-character hex token from magic link
Response
Refresh token (mobile/desktop clients)
Password Reset
Send Password Reset
POST /api/auth/email/send-reset-password
curl -X POST https://your-app.region.insforge.app/api/auth/email/send-reset-password \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com"
}'
Send password reset code or link.
Body Parameters
Email address for password reset
Response
{
"success" : true ,
"message" : "If your email is registered, we have sent you a password reset link. Please check your inbox."
}
Exchange Reset Code for Token
POST /api/auth/email/exchange-reset-password-token
curl -X POST https://your-app.region.insforge.app/api/auth/email/exchange-reset-password-token \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"code": "123456"
}'
Exchange 6-digit code for reset token (code method only).
Body Parameters
Response
{
"token" : "a1b2c3d4e5f6..." ,
"expiresAt" : "2024-01-15T11:30:00Z"
}
Reset Password
POST /api/auth/email/reset-password
curl -X POST https://your-app.region.insforge.app/api/auth/email/reset-password \
-H "Content-Type: application/json" \
-d '{
"newPassword": "newSecurePassword123",
"otp": "a1b2c3d4e5f6..."
}'
Reset password with token.
Body Parameters
New password meeting requirements
Reset token from magic link or exchange endpoint
Response
{
"message" : "Password reset successfully"
}
User Profiles
Get User Profile by ID
GET /api/auth/profiles/{userId}
curl https://your-app.region.insforge.app/api/auth/profiles/550e8400-e29b-41d4-a716-446655440000
Get public profile for any user (no authentication required).
Path Parameters
Response
{
"id" : "550e8400-e29b-41d4-a716-446655440000" ,
"profile" : {
"name" : "John Doe" ,
"avatar_url" : "https://example.com/avatar.jpg"
}
}
Update Current User Profile
PATCH /api/auth/profiles/current
curl -X PATCH https://your-app.region.insforge.app/api/auth/profiles/current \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"profile": {
"name": "Jane Doe",
"avatar_url": "https://example.com/new-avatar.jpg",
"bio": "Software developer"
}
}'
Update authenticated user’s profile.
Body Parameters
Profile data including name, avatar_url, and custom fields
Response
{
"id" : "550e8400-e29b-41d4-a716-446655440000" ,
"profile" : {
"name" : "Jane Doe" ,
"avatar_url" : "https://example.com/new-avatar.jpg" ,
"bio" : "Software developer"
}
}
OAuth Authentication
Initiate OAuth Flow
GET /api/auth/oauth/{provider}
curl "https://your-app.region.insforge.app/api/auth/oauth/google?redirect_uri=https://myapp.com/callback&code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM"
Generate OAuth authorization URL with PKCE support.
Path Parameters
OAuth provider: google, github, discord, linkedin, facebook, instagram, tiktok, apple, x, spotify, microsoft
Query Parameters
URL to redirect after authentication (receives insforge_code parameter)
PKCE code challenge (Base64URL(SHA256(code_verifier))) for mobile/desktop apps
Response
{
"authUrl" : "https://accounts.google.com/o/oauth2/v2/auth?client_id=...&redirect_uri=...&response_type=code&scope=openid+email+profile&state=..."
}
Exchange OAuth Code
POST /api/auth/oauth/exchange
curl -X POST https://your-app.region.insforge.app/api/auth/oauth/exchange \
-H "Content-Type: application/json" \
-d '{
"code": "insforge_code_received_from_callback",
"code_verifier": "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
}'
Exchange insforge_code for access and refresh tokens (PKCE flow).
Body Parameters
insforge_code from OAuth callback redirect
Original code_verifier (43-128 characters)
Response
Admin Endpoints
Admin Login
POST /api/auth/admin/sessions
curl -X POST https://your-app.region.insforge.app/api/auth/admin/sessions \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com",
"password": "adminPassword"
}'
Authenticate as admin user for dashboard access.
List All Users
curl https://your-app.region.insforge.app/api/auth/users?limit= 10 & offset = 0 & search = john \
-H "Authorization: Bearer ADMIN_ACCESS_TOKEN"
List all users with pagination (admin only).
Query Parameters
Number of records to skip
Maximum records to return
Generate Anonymous Token
POST /api/auth/tokens/anon
curl -X POST https://your-app.region.insforge.app/api/auth/tokens/anon \
-H "Authorization: Bearer ADMIN_ACCESS_TOKEN"
Generate non-expiring anonymous token for public API access (admin only).
Response
{
"accessToken" : "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." ,
"message" : "Anonymous token generated successfully (never expires)"
}