All templates

Auth

Mock a JWT login flow

Login, refresh, and a protected endpoint that actually rejects you.

5 routes · live immediately · no account needed

A conventional bearer-token flow: log in for an access token, call a protected route with it, refresh when it expires. It rejects properly rather than rubber-stamping everything — /auth/me returns 401 unless an Authorization header is present, and /auth/login only succeeds when the password is correct-password. That means your interceptor, your redirect-to-login, and your refresh-on-401 retry get tested against a mock that actually says no.

What you get

POST/auth/logintemplatedconditional200 OK
POST/auth/login401 Unauthorized
GET/auth/metemplatedconditional200 OK
GET/auth/me401 Unauthorized
POST/auth/refreshtemplated200 OK

Response template

POST /auth/login

Values in double braces are rendered per request.

{
  "access_token": "{{ uuid4() }}",
  "refresh_token": "{{ uuid4() }}",
  "token_type": "Bearer",
  "expires_in": 3600,
  "user": {
    "id": "{{ uuid4() }}",
    "email": "{{ request.body.email }}",
    "name": "Ada Lovelace"
  }
}

Good for

  • Build a login screen before the auth service exists
  • Test the 401 → refresh → retry path deterministically
  • Demo a signed-in experience without a real identity provider