OAuth, tokens and login providers · senior
Identity providers, SAML SSO and service identity
Choose build, buy or host for login by features, cost at scale and exit path. Enterprise customers bring SAML, and services call each other with their own identities, not with trust in the network.
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceThe notes
What you must know
- Needs list for a consumer product: OTP by SMS or WhatsApp, social login, staff SSO, MFA for staff, user admin, audit logs, account deletion, maybe enterprise SSO later.
- Auth0 (Okta): fastest to start and rich in features, but pricing by monthly active users grows steeply for consumer apps.
- Cognito: cheap at scale and fits AWS (API Gateway and ALB authorizers), but customisation is limited, some settings cannot change after the pool is created, and password hashes cannot be exported, so leaving needs a gradual migration.
- Keycloak: open source, full control and data in your own region, but you run it (database, high availability, upgrades, security patches).
- Think about the exit path before choosing: can you export users and hashes, and can you migrate gradually at login?
- SAML SSO for an enterprise customer: the user enters a work email, you find their company and redirect with an AuthnRequest, their identity provider logs them in and POSTs a signed SAMLResponse to your Assertion Consumer Service URL, and you create your own session.
- Checks on the response: signature against the certificate from their metadata (use a library that resists XML signature wrapping), Issuer, Audience equal to your entity id, Destination and Recipient, NotBefore and NotOnOrAfter, InResponseTo, and each assertion id used once. Do not verify XML signatures by hand.
- Zero trust between services: identity is checked on every call, not assumed from the network. Each service gets its own client in the identity provider, asks for a token with the target audience and a narrow scope (payouts:create), and caches it until near expiry. The target checks signature, issuer, audience and scope.
- Network policies are a fence, not an identity. Use both. Prefer private_key_jwt or mTLS client authentication to shared secrets.
The red pen
Common traps: mistake → fix
Mistake: A private network means services can trust each other
Fix: One compromised pod can call everything. Check identity on every call.
Mistake: We can always switch identity provider later
Fix: Password hashes may not be exportable. Plan migration at login.
Mistake: SAML is only an XML login page
Fix: Signature and audience checks are security-critical and easy to get wrong.
Easy to hard
Questions interviewers ask, easy to hard
- How do you choose between Auth0, Cognito, Keycloak and building your own login?
- Walk through a SAML sign-in from the user's work email to your session.
- What do you check in a SAML response?
- Any pod can call the payouts API. What do you do this week and what is the proper fix?
- How do you migrate users between identity providers without a password reset for everyone?
Explain it out loud
Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.
Practise by voiceYour first interview is free
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.