HomeChallengesRepsProblemsLeaderboardTake a challenge

Anyone’s wallet, for anyone who asks

Change the id in the URL and you can read another customer’s balance. The credit endpoint does not need a token at all. Close both, and answer with the status code that tells the client the truth.

Intermediate20 min on the clock6 graded checks · 100 pointsServices That Fail Politely

AssumesAuth APIIssuing the token and checking a role come first. This stage is about what the token does not tell you: whose wallet it is.

Graded by reading your code against the checklist below.

What you build

  • Keep the token’s claim names as issued, so "sub" can be read
  • Make the admin policy require the right scope as well as the role
  • Let a customer read only their own wallet
  • Let an admin read any wallet
  • Return 403 Forbidden, not 401, when the caller is signed in but not allowed
  • Protect the credit endpoint with the admin policy

Done means

Claims read as issued, policy checks role and scope, owner-or-admin enforced in the action with Forbid(), and no public write.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Claims keep the names they were issued with+15Authentication and tokens
  2. The admin policy also requires the scope+20Roles and policies
  3. A customer can read only their own wallet+25Roles and policies
  4. An admin can still read any wallet+10Roles and policies
  5. Signed in but not allowed is 403, not 401+15Roles and policies
  6. The credit endpoint requires the admin policy+15Roles and policies

What it teaches

The rest of Services That Fail Politely