Authentication Starter Kit
Mock Authentication API for Frontend Login Flows
The Authentication Starter Kit is a simulated auth backend for building login, registration and account screens before your real identity service exists. It returns realistic JSON for registration, login, token refresh, password recovery, email verification, profile updates and active sessions. It is a mock: every request gets the same configured response, so it is for developing interface flows, not for protecting anything.
Simulated authentication, not real security
This kit does not check credentials or validate tokens. Any email and password gets the same login response, the tokens are fixed placeholder strings, and the user returned by GET /auth/me is the same whatever you send. Use it to build and test screens only, and never as a stand-in for production authentication or to protect real data.
What you can build
Build login, registration and session screens
These are the interface flows the kit's endpoints let you build and test against hosted URLs.
Registration
POST /auth/register returns 201 with the new user and verification_required set to true, so you can send people to a check-your-email screen. POST /auth/verify-email returns the verified user.
- POST
/auth/register - POST
/auth/verify-email
- POST
Login and token handling
POST /auth/login returns access_token, refresh_token, token_type, expires_in and the user. Store the tokens as your real API would require and redirect to the app.
- POST
/auth/login
- POST
Protected pages and profile
GET /auth/me returns the current user for a header menu or account page, and PATCH /users/me returns the updated profile for an edit form.
- GET
/auth/me - PATCH
/users/me
- GET
Token refresh and logout
POST /auth/refresh returns a new token pair and POST /auth/logout confirms the session ended, which lets you build the refresh and sign-out paths of your client.
- POST
/auth/refresh - POST
/auth/logout
- POST
Password recovery
POST /auth/forgot-password and POST /auth/reset-password return confirmation messages for the two screens of a password reset flow.
- POST
/auth/forgot-password - POST
/auth/reset-password
- POST
Active sessions
GET /sessions returns a list of devices with browser, location and last activity, enough to build a sessions or security settings page.
- GET
/sessions
- GET
Endpoint reference
All 10 Authentication endpoints
This list is generated from the kit itself. Paths match exactly, so only these paths exist after you launch it.
| Method | Path | Status | What it returns |
|---|---|---|---|
| POST | /auth/register | 201 | Register user. Simulates successful user registration. |
| POST | /auth/login | 200 | Login. Simulates successful email and password authentication. |
| POST | /auth/logout | 200 | Logout. Simulates invalidating the current session. |
| POST | /auth/refresh | 200 | Refresh token. Simulates exchanging a refresh token for a new access token. |
| GET | /auth/me | 200 | Current user. Returns the authenticated user's profile. |
| POST | /auth/forgot-password | 200 | Forgot password. Simulates sending a password-reset email. |
| POST | /auth/reset-password | 200 | Reset password. Simulates successfully changing a forgotten password. |
| POST | /auth/verify-email | 200 | Verify email. Simulates verifying a user's email address. |
| PATCH | /users/me | 200 | Update user. Simulates updating the authenticated user's profile. |
| GET | /sessions | 200 | Active sessions. Returns active login sessions for the user. |
Example responses
What the endpoints return
These are real responses from the kit.
Login
{
"success": true,
"access_token": "mock_access_token_abc123",
"refresh_token": "mock_refresh_token_xyz789",
"token_type": "Bearer",
"expires_in": 3600,
"user": {
"id": "user_001",
"full_name": "Sam Wilson",
"email": "sam@example.com",
"avatar_url": "https://images.example.com/users/sam-wilson.jpg",
"role": "member",
"email_verified": true,
"created_at": "2026-07-10T09:30:00Z"
}
}Register user
{
"success": true,
"message": "Account created successfully.",
"user": {
"id": "user_001",
"full_name": "Sam Wilson",
"email": "sam@example.com",
"avatar_url": "https://images.example.com/users/sam-wilson.jpg",
"role": "member",
"email_verified": false,
"created_at": "2026-07-10T09:30:00Z"
},
"verification_required": true
}Current user
{
"data": {
"id": "user_001",
"full_name": "Sam Wilson",
"email": "sam@example.com",
"avatar_url": "https://images.example.com/users/sam-wilson.jpg",
"role": "member",
"email_verified": true,
"created_at": "2026-07-10T09:30:00Z"
}
}Call the endpoints
curl and fetch examples
These URLs only work after you launch the kit, because the kit then exists in your own project. Replace YOUR_PROJECT_KEY with the project key shown in your dashboard.
curl -i \
-X POST \
-H "Content-Type: application/json" \
-d '{"email":"sam@example.com","password":"mock-password"}' \
https://apis.getforgeapi.com/YOUR_PROJECT_KEY/auth/logincurl -i \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
https://apis.getforgeapi.com/YOUR_PROJECT_KEY/auth/meconst API_BASE_URL = "https://apis.getforgeapi.com/YOUR_PROJECT_KEY";
const accessToken = "YOUR_ACCESS_TOKEN"; // from the login response
const response = await fetch(API_BASE_URL + "/auth/me", {
headers: {
Authorization: "Bearer " + accessToken,
},
});
if (!response.ok) {
throw new Error("Request failed with status " + response.status);
}
const json = await response.json();
// json.data is the current user. The mock returns the same user for any token.More request examples are in Calling endpoints.
Frontend example
A React sign-in hook
This hook wires the register, login, profile and logout calls into a small state container. Because the mock ignores credentials, use it to test the UI paths, and replace the base URL with your real identity service later.
import { useState } from "react";
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;
async function apiGet<T>(path: string, token?: string): Promise<T> {
const response = await fetch(API_BASE_URL + path, {
headers: token ? { Authorization: "Bearer " + token } : {},
});
if (!response.ok) {
throw new Error("GET " + path + " failed with status " + response.status);
}
return response.json() as Promise<T>;
}
async function apiPost<T>(path: string, body: unknown): Promise<T> {
const response = await fetch(API_BASE_URL + path, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(body),
});
if (!response.ok) {
throw new Error("POST " + path + " failed with status " + response.status);
}
return response.json() as Promise<T>;
}
type User = { id: string; full_name: string; email: string };
type Session = {
access_token: string;
refresh_token: string;
user: User;
};
export function useAuth() {
const [session, setSession] = useState<Session | null>(null);
const [error, setError] = useState("");
async function register(fullName: string, email: string, password: string) {
const json = await apiPost<{ verification_required: boolean }>(
"/auth/register",
{ full_name: fullName, email, password },
);
return json.verification_required; // show a check-your-email screen
}
async function login(email: string, password: string) {
setError("");
try {
// The mock ignores the credentials and always returns the same session.
setSession(await apiPost<Session>("/auth/login", { email, password }));
} catch {
setError("Could not sign in. Please try again.");
}
}
async function loadProfile() {
if (!session) return null;
const json = await apiGet<{ data: User }>("/auth/me", session.access_token);
return json.data;
}
async function logout() {
await apiPost("/auth/logout", {});
setSession(null);
}
return { session, error, register, login, loadProfile, logout };
}Keep the base URL in an environment variable such as VITE_API_BASE_URL or NEXT_PUBLIC_API_BASE_URL. When your real backend is ready, change that value; if it keeps the same paths and response shapes, your components do not need to change. The Create a REST API Online tutorial walks through that handover.
Accurate expectations
What this mock does and does not do
Every Starter Kit
- Responses are static. Each endpoint returns the JSON configured for it, so the same request always gets the same response.
- Paths match exactly. Only the paths listed in the endpoint reference exist, and there are no automatic dynamic route parameters.
- There is no automatic filtering, sorting or pagination. Query strings are not used to choose a response, so adding ?page=2 returns the same response.
- Nothing is saved. POST, PUT, PATCH and DELETE endpoints return the response configured for them, and request bodies are not stored.
- Response delays and required request headers are available on paid plans. You can edit an endpoint's JSON and status code after launching the kit.
The Authentication kit
- Credentials are never checked, so there is no wrong-password response. Every endpoint in the kit returns 200 or 201.
- Tokens are fixed placeholder strings, and GET /auth/me returns the same user whatever Authorization header is sent.
- To test a failed sign-in or an expired session, edit an existing endpoint's status code and JSON in your project (for example make POST /auth/login return 401), then restore it afterwards.
Project and endpoint limits depend on your plan. See API limits for the current allowances.
Related Starter Kits and guides
Looking for a different kit? Browse all ready-made mock APIs.
Frequently asked questions
Authentication Starter Kit questions
Is this real authentication?
No. The kit returns fixed, pre-written responses. It does not check credentials, issue real tokens or protect any data, so it is only for building and testing interface flows.
Which plan do I need for the Authentication kit?
The Authentication kit requires the Pro plan or higher (Pro and Pro Plus). You can start with a free account and upgrade later. See the pricing page for the current plans.
Is there a free way to test a login screen?
Yes. The E-Commerce Starter Kit demo includes POST /auth/login and can be launched without an account. The Free kits Blog CMS and Hotel Booking also include a login endpoint.
How do I test a failed login or an expired session?
Edit an existing endpoint in your launched project, for example change the status code of POST /auth/login to 401 and replace its JSON with an error object. Restore the original response when you are done.
Can I use this to secure my app while I build it?
No. Anyone who can reach the URL gets the same responses. Do not use mock endpoints to protect real data, and replace them with your real authentication service before launch.
Build against Authentication today
Requires the Pro plan or higher (Pro and Pro Plus). Launch the kit, call its hosted URLs and edit the responses to match your frontend.