Sign-in, session refresh, MFA, password reset, session invalidation. Get one of these wrong and you've built the login page for someone else's attack. This page is the checklist we hold every auth surface against.
Default for browser apps. Revocable server-side, immune to XSS token theft, works with CSRF protection via SameSite=Lax. If your app is 'a website with a login,' this is the right answer.
Mobile apps, service-to-service, cross-domain APIs. Short access (15min) + long refresh (7d), refresh stored in HttpOnly cookie. Never a raw JWT in localStorage — one XSS and it's over.
Used once, invalidated. Even if the user hits back.
Not 24 hours. Not 'until password changed.' 15 minutes.
'If that email exists, we sent a link' — same response either way.
5 requests / hour / email, 20 / hour / IP. Then a captcha.
If the account was compromised, kick every session.
You always know when a reset happened, even if you didn't ask.
Session cookies (HttpOnly, SameSite=Lax, Secure) for browser apps — simpler, revocable, no token-in-localStorage class of XSS bug. JWTs when you have a mobile app or a service-to-service call where cookies don't fit. Never store a long-lived JWT in localStorage.
Tell us your goals — we'll recommend the right technology honestly, even if it isn't this one.