Authentication problems rarely announce themselves as security incidents. They arrive as support tickets: customers logged out mid-order, reset links that work twice, staff seeing another branch's data, or an MFA prompt that disappears after one failed attempt. Each symptom points to an architectural decision made earlier and never tested under pressure.
This troubleshooting guide covers seven failures that appear repeatedly in business applications, the causes behind them and the fixes that hold. It assumes a web or mobile application with a server-side API, which describes most custom portals, commerce systems and internal tools.
Start with the symptom
- Users are logged out before the session should expire, or stay logged in after logout.
- A password reset link works more than once, or works for the wrong account.
- MFA can be skipped by changing a parameter, using an old session or calling the API directly.
- A user with one role can reach another role's screen or data by editing an identifier.
- Single sign-on works for most users but maps a few to the wrong role.
- Nobody can reconstruct who changed a password, enabled MFA or granted access.
Problem 1: sessions that outlive logout
Cause: logout clears the browser cookie but leaves the server-side session or refresh token valid. Mobile apps may keep a token in secure storage and never revoke it.
Fix: invalidate the server-side session on logout, rotate the session identifier at login and privilege change, and give users a way to revoke other devices. Set idle and absolute timeouts that match the risk of the application, not the convenience of the demo. Test logout by replaying the old cookie or token against the API.
Problem 2: tokens stored where scripts can read them
Cause: access or refresh tokens are placed in local storage, a readable cookie or a mobile log. Any cross-site scripting issue then becomes account takeover.
Fix: keep refresh tokens in an HttpOnly, Secure cookie with an appropriate SameSite setting, or in the platform's secure storage for mobile. Keep access tokens short-lived, rotate refresh tokens and detect reuse. Never log tokens, and scrub them from error reports.
Problem 3: password reset becomes a back door
Cause: reset tokens are predictable, never expire, are not tied to the account, or the response reveals whether an email exists. Support staff may also reset an account after a phone call with no verification.
Fix: use a random, single-use token with a short expiry, store only its hash, invalidate it after use and bind it to the account and purpose. Return the same response whether or not the address exists. Give support a documented identity-verification process, and log every manual reset.
Problem 4: MFA that can be skipped
Cause: MFA is enforced in the user interface but not in the API, or a "remember this device" cookie never expires. A fallback channel may bypass the second factor entirely.
Fix: enforce MFA at the authorisation layer for every sensitive route, not only at the login screen. Bind the second factor to the session, expire trusted devices, and rate-limit attempts. Prefer phishing-resistant methods such as passkeys for administrators and finance users, with a documented recovery path.
Problem 5: authentication treated as authorisation
Cause: the application checks that a user is logged in, then trusts an object identifier from the request. Changing an order number, student ID or invoice reference exposes another customer's record.
Fix: check permission and ownership on the server for every object access. Centralise policy decisions rather than repeating them in each controller. Test with two accounts at the same role and two at different roles, and include the API in the test, not just the screens.
Problem 6: SSO mappings drift
Cause: roles are mapped from directory groups once during rollout, then groups are renamed, nested or reused. Departed staff keep access because the mapping never refreshes.
Fix: treat group mapping as configuration under version control. Reconcile membership on a schedule, alert on unmapped groups, and fail closed rather than granting a default role. Document who approves a mapping change and test joiner, mover and leaver scenarios.
Problem 7: no usable audit trail
Cause: logs record successful logins but not failures, MFA changes, password resets, role changes or token revocations. Logs are scattered across the application, proxy and identity provider.
Fix: define the events that matter, record actor, target, time, source and outcome, and send them to a store that application administrators cannot edit. Set retention to match policy and review alerts for repeated failures, impossible travel and privilege changes.
Diagnostic sequence
- Draw the login flow end to end: browser, API, identity provider, database and email or SMS provider.
- List every place a session or token is created, stored, refreshed and revoked.
- Reproduce each symptom with two test accounts and record the exact request and response.
- Test the API directly, bypassing the interface, for every sensitive action.
- Inspect cookie flags, token lifetimes and logout behaviour in a staging environment.
- Review reset, MFA enrolment and recovery flows for enumeration and replay.
- Check role and group mappings against the current directory, including leavers.
- Confirm that the audit trail captures the events you would need after an incident.
A design baseline
- Use a proven identity library or provider rather than custom cryptography.
- Separate authentication from authorisation, and enforce policy server-side.
- Short-lived access tokens, rotating refresh tokens and revocable sessions.
- Phishing-resistant MFA for privileged users, with tested recovery.
- Rate limits and lockout behaviour that do not create a denial-of-service weapon.
- Centralised audit logging with alerting on privilege and credential changes.
Metrics
- Failed login and MFA challenge rates, segmented by source.
- Reset requests completed and the time from request to use.
- Sessions revoked after logout, password change and role change.
- Accounts without MFA, especially privileged accounts.
- Authorisation test coverage for object-level access.
- Time to investigate an identity event using the audit trail.
Where this fits
If you need the flow reviewed or rebuilt, start with Custom Software & Integrations. The pricing page explains how we separate assessment, remediation and support. For the commercial side of the same work, read what API authentication and authorisation costs in Bangladesh.
Sources
- NIST SP 800-63B, Digital Identity Guidelines, accessed 17 November 2026.
- OWASP, Top 10 Web Application Security Risks, accessed 17 November 2026.
- OWASP, Session Management Cheat Sheet, accessed 17 November 2026.
- FIDO Alliance, World Passkey Day 2026 report, accessed 17 November 2026.
Responses (0)
No comments yet. Add the first one below.
Leave a response
Your email address will not be published. Required fields are marked *.