LEARN. PRACTICE. EXPLAIN.
Learning paths & interview practiceP
← Build an authenticated dashboard
BUILD → VERIFY → EXPLAIN · STEP 5 OF 6

Handle expired sessions and reliable logout

Clear private data when authority ends and be honest when logout fails.

UNDERSTAND

Bring these concepts with you

BUILD

Your implementation

  1. Treat a 401 from invoice loading as an expired session: clear identity and private rows and invite the user to log in.
  2. Implement logout as a server POST. Only confirm logout after the server responds successfully; surface a retryable error when the request fails.
  3. Invalidate older requests when logout begins. In the browser, log out and refresh; then log in again, wait 60 seconds, and request an invoice to see expiry handling.
async function logout() {
  // Request server revocation; publish signed out only when confirmed.
}
Need a hint?
  • Clearing a client flag cannot revoke a server credential.
  • Use the same generation counter across restoration, invoice loading and logout.

Saved on this device · 0 / 6000 · Do not include passwords or private data.

VERIFY

Acceptance checks

From the folder containing your downloaded files, run:

node checks.mjs ./starter.mjs 5

This runs checks up to this step. Earlier steps must work first. Mark each result only after checking your implementation; the website does not run or grade it.

Record your attempt to enable the checklist and reference comparison.

Compare with the reference

Attempt the step first, then compare decisions and behavior. There can be more than one correct implementation.

EXPLAIN

Your interviewer asks

The user clicks logout while a data request is pending. What prevents that response from repopulating the dashboard?

Say your answer aloud, then record the trade-offs and evidence in your notes above.

LOCAL VOICE REHEARSAL

Rehearse your step walkthrough aloud

Target pacing: 02:00 · Stays in this browser only; never uploaded.

00:00/ 02:00
AlifBay Prep