2. HTTP, status codes & redirect chain

10 cards

Review this deck
All cards in this deck

401 in MemberPortal

Session invalid or expired, or the `X-XSRF-TOKEN` header is missing/wrong on `/api/s/*`.

403 in MemberPortal

SSO from the app is rejected (the token is valid but the user is not eligible, e.g. not an online trading account).

400 in MemberPortal

Malformed request or the wrong flow was called (e.g. operator mode calling the web login endpoint; POSTing form-urlencoded to an endpoint that only accepts JSON).

404 for test endpoints

When the STAGE/password guard is not satisfied, the mock endpoint returns 404 instead of 403 so it does not reveal that the endpoint exists.

form-urlencoded vs JSON

The IdP token endpoint `/oauth/token` accepts `application/x-www-form-urlencoded`; the BFF's internal APIs usually accept JSON; the spec must state the Content-Type of each endpoint.

Per-route body parser trap

If the BFF disables the global body parser and attaches `json()` to only one route, a form-urlencoded request to that route gets a 400 because the body cannot be parsed.

OIDC redirect chain

BFF 302 → IdP /authorize → user logs in → IdP 302 back to the BFF callback with code+state → BFF 302 to successUrl; a cookie only travels on the hop to the domain it was set for.

Same-origin successUrl rule

parse with `new URL()`, `origin` must be exactly `https://portal.example.com`; on a different origin (including `http://`, unknown subdomains, userinfo `@`) ignore it and redirect to the company home page `https://www.example.com/`.

`_gl` parameter appending rule

If successUrl has no query yet, append with `?`; if it already has a query, append with `&`; the spec must state this rule explicitly.

Open redirect

A vulnerability where the app redirects to a client-controlled URL without a domain allow-list; attackers use it to send users to a phishing page after a genuine login.

2. HTTP, status codes & redirect chain – Flashcards – Login Flow | Học Dev