How to use Mock Authentication Response
- Optionally enter the user email, scopes and roles.
- Pick the shape and the outcome (success or a failure case).
- Generate and use the body in front-end auth mocks.
Mock Authentication Response features
- OAuth 2.0, OpenID Connect, JWT pair, session cookie and API key shapes
- Decodable unsigned JWTs (alg "none") or mock HS256 signatures with realistic claims
- Failure variants: invalid credentials, expired token, locked account, unverified email, MFA required
- Correct headers: Cache-Control: no-store, WWW-Authenticate, Set-Cookie, Retry-After
- Decoded claims shown alongside the response
Mock Authentication Response example
OAuth 2.0 token response
Input:
Shape: OAuth 2.0, outcome: success, expires in 3600Output:
{
"access_token": "eyJhbGciOiJub25lIiwidHlwIjoiSldUIn0.eyJpc3MiOiJodHRwczovL2F1dGguZXhhbXBsZS5jb20iLCJzdWIiOiI…",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "rt_9kM2…",
"scope": "openid profile email offline_access"
}Frequently asked questions about Mock Authentication Response
What shapes are generated?
OAuth 2.0 token responses, OpenID Connect responses with an id_token, JWT access/refresh pairs with a user object, session logins with a Set-Cookie header and CSRF token, and API key issuance.
Are the JWTs real?
They decode with any JWT tool and contain realistic claims (iss, sub, aud, iat, exp, scope, roles), but they are unsecured (alg "none") or carry a random mock signature. No server must ever accept them.
Which failure cases exist?
Invalid credentials/grant, expired token (401 with WWW-Authenticate), locked account (423 with Retry-After), unverified email (403) and MFA required.
Can I set the user and scopes?
Yes — provide the email, scopes and roles; the name is synthetic. The decoded claims are shown next to the response for quick inspection.
Technical notes
The access and id tokens are built as header.payload. with an empty signature, which RFC 7519 defines as an unsecured JWT, or with a random signature segment when a mock HS256 header is requested. They carry iss, sub, aud, iat, exp, nbf, jti, scope and roles so client-side expiry logic can be exercised, but they cannot be verified by any real server.