SaaS Authentication Failed: Causes and Fixes
Match the error code to its cause, then apply the matching fix for logins, single sign-on, two-factor codes, API keys and network blocks.
Quick answer
Read the exact error before changing any setting. An HTTP 401 means the server rejected the credentials or the token. An HTTP 403 means the server accepted the identity but denied the action. A redirect_uri_mismatch message means the callback address differs from the registered one. An invalid two-factor code usually points to a device clock that has drifted.
Three checks separate account problems from browser problems and vendor outages: open a private window, read the vendor status page, and read the response body in the browser developer tools.
In this guide
Match the Error to the Cause
The message “authentication failed” carries little information on its own. The status code, the error string and the place where the failure appears narrow the cause to one or two layers. The table below lists the combinations that occur most often.
| What you see | Likely cause | First fix |
|---|---|---|
| HTTP 401, “invalid credentials” | Wrong, expired or revoked password, token or key | Reset the password or issue a new key, then confirm the header format |
| HTTP 403 | Valid identity without permission: role, scope or IP rule | Ask an administrator to check the role, scope and allowlist |
| Single sign-on loop | Callback address mismatch or blocked cookie | Compare the callback address character by character, then clear site cookies |
| SAML assertion rejected | Expired certificate, wrong entity ID or clock difference | Upload fresh identity provider metadata and check server time |
invalid_grant | Authorization code reused or expired, or refresh token revoked | Start the sign-in flow again and reauthorize the app |
| Two-factor code rejected | Device clock out of step with the server | Turn on automatic time, or use a backup code |
| Works in a private window only | Stale cookie or extension conflict | Clear cookies for that one domain, then disable extensions |
| HTTP 429 | Too many requests or login attempts | Wait for the time in the Retry-After header |
| Fails on one network only | IP allowlist or VPN exit address | Test on another network, then ask the administrator |
Where a Login Breaks
Authentication proves who a person is. Authorization decides what that person may do. A SaaS login passes through both stages, and each stage has its own failure points.
- BrowserSends credentials, cookies or a token.Stale cookie, extension, blocked cross-site cookie
- Identity providerChecks the password or the single sign-on assertion.Wrong password, locked account, expired certificate
- Second factorChecks the code, passkey or prompt.Clock drift, lost device, missing backup codes
- Token exchangeReturns a code, then a token, to the app.Callback mismatch, reused code, clock skew
- App or APIValidates the token and the permission.Expired token, missing scope, IP allowlist
The earlier the stage, the more likely the cause is local to the browser or the account.
Account and Credential Checks
Start with the account itself. Several failures that look technical come from the account state.
- Use a private window. This removes saved cookies and most extensions. A successful login there points to local browser data.
- Check the sign-in method. An account created through a work Google or Microsoft identity may have no password at all. The login page then needs the single sign-on button.
- Reset the password once. Many platforms lock an account after a small number of failed attempts, and the limit differs by vendor. One reset is safer than repeated guesses.
- Confirm the account is still active. An administrator may have suspended or removed the user, or a billing problem may have paused the workspace.
- Update the password manager. An old saved entry will refill the previous password at the next login.
Read the Response Before Guessing
The response body usually names the problem. Open the browser developer tools, select the Network tab, repeat the login, and click the failed request. Read the status code, the WWW-Authenticate header and the JSON body.
On 15 November 2026 I sent three requests from an Ubuntu 24.04 sandbox to check how real services report a rejected login. The GitHub API returned HTTP 401 for a request with no credentials and HTTP 401 for a request with an invalid token. The Anthropic API returned HTTP 401 with the error type authentication_error and the message that the x-api-key header is required. A 401 is the expected signal for a missing or rejected credential, while a permission problem would appear as a 403.
curl -i https://api.github.com/user curl -i -H "Authorization: Bearer YOUR_TOKEN" https://api.github.com/user curl -i https://api.anthropic.com/v1/models
The two header formats used most often are the bearer token and a custom key header. The vendor documentation states which one applies, and the wrong choice returns a 401 even when the key is valid.
Authorization: Bearer YOUR_API_KEY X-API-Key: YOUR_API_KEY
Single Sign-On and OAuth Failures
Single sign-on failures often produce a redirect loop or a blank error page. The cause is usually a small mismatch between two configurations.
Callback address
The redirect URI registered with the identity provider must match the address the app sends. A trailing slash, a different protocol or a missing port is enough to cause a failure. Compare the two values side by side instead of reading them from memory.
OAuth error codes
The codes below follow RFC 6749 and RFC 6750. Some providers add their own codes, and redirect_uri_mismatch is one of them. Under RFC 6749, the token endpoint reports a mismatched redirect address as invalid_grant.
| Code | Returned by | HTTP status | Meaning and fix |
|---|---|---|---|
invalid_client | Token endpoint | 401 or 400 | Client authentication failed. Copy the client ID and secret again from the provider console. |
invalid_grant | Token endpoint | 400 | The code is expired or already used, the refresh token is revoked, or the redirect address differs. Restart the flow. |
invalid_scope | Either endpoint | 400 | The requested scope is unknown or larger than the grant. Request fewer scopes. |
access_denied | Authorization endpoint | Redirect parameter | The user or the server refused the request. Retry with the correct account or ask for administrator consent. |
temporarily_unavailable | Authorization endpoint | 503 suggested | The server is overloaded. Retry after a delay. |
invalid_token | Resource server | 401 | The access token is expired, revoked or malformed. Refresh it. |
insufficient_scope | Resource server | 403 | The token lacks a required scope. Authorize again with that scope. |
RFC 6749 recommends an authorization code lifetime of no more than 10 minutes, and the code works once. A user who leaves a consent screen open, or who reloads the callback page, will receive invalid_grant.
SAML failures
A SAML assertion carries validity times, and the receiving app compares them with its own clock. A server clock that runs several minutes off can reject a correct assertion. Certificates also expire. Download the current metadata file from the identity provider and upload it to the SaaS app.
Check three further values when the error persists: the entity ID, the assertion consumer service URL and the audience. The SAML-tracer extension for Firefox and Chrome shows the assertion that the browser sends, which makes a mismatch visible.
Connected apps and AI connectors
OAuth connections to outside tools expire or lose access when a password changes or an administrator removes consent. The setup guide for connecting Semrush to Claude through MCP includes error fixes for that kind of connection. A connector that can write to an account needs wider scopes than a read-only one, a point covered in the guide to what a Google Ads MCP can do. The reliability checklist in the guide to using Claude Cowork and Make together applies the same idea to automation handoffs.
Two-Factor Code Problems
A time-based one-time password, or TOTP, combines a shared secret with the current time. The default step is 30 seconds, as set out in RFC 6238. The server and the phone must agree on the current step, within whatever tolerance the vendor allows.
I checked the algorithm against the RFC 6238 test vector and then generated codes for neighbouring time steps with the same secret. Every step gave a different code. A phone that sits in the wrong step therefore produces a code that the server rejects, even though the code looks correct.
Same secret, different time steps
Codes computed with the RFC 6238 test secret at a fixed server time. Real accounts use a secret that is unique to the user.
Vendors differ in how many neighbouring steps they accept. RFC 6238 describes a limited window for delay, so small drift may pass while larger drift fails.
- Turn on automatic time. On iPhone, open Settings, General, Date & Time, and enable Set Automatically. On Android, open Settings, System, Date & time, and use network-provided time.
- Use a backup code. Most vendors issue a set of single-use codes when two-factor sign-in is enabled. Each code works once.
- Move to an app that backs up. Google Authenticator can sync codes to a Google Account. Authy still runs on mobile, although Twilio ended the Authy desktop apps in 2024.
Authenticator app strengths
- Codes are generated on the device, so no mobile signal is needed
- The secret is not tied to a phone number, so a SIM swap does not move it
- The method follows an open standard
Authenticator app weak points
- A wrong device clock causes rejected codes
- A lost phone without backup codes locks the account
- SMS codes depend on carrier delivery and on control of the phone number
Passkeys remove the password and the code from the login. Support varies by vendor, so check the security page of the account before relying on them.
API Key and Token Errors
An integration fails for a short list of reasons: the key is revoked, the key belongs to another environment, the header format is wrong, or the token has expired.
- Confirm the environment. Test keys and live keys are separate on most platforms, and each works only against its own environment.
- Strip hidden characters. A trailing space or line break copied from a dashboard changes the header value. Trim the key in code.
- Refresh expired tokens. Access tokens are short-lived by design. Store the refresh token and request a new access token when the old one expires.
- Check for a revoked refresh token. A password change, an administrator action or a removed consent can revoke it. The refresh call then returns
invalid_grantand the user must authorize again. - Replace the key if its status is unknown. Issue a new key, update every environment variable that holds the old one, and delete the old key.
Treat a pushed key as exposed.Removing a key from the latest commit leaves it in the repository history. Revoke the key at the provider first, then clean the history.
Rotation frequency is a policy choice. SOC 2 and ISO 27001 do not fix a rotation interval, so follow the vendor guidance and the internal risk policy. Rotate at once after exposure or after a person with access leaves.
Browser and Session Problems
- Clear cookies for the affected domain only. In Chrome, open Developer Tools, choose Application, then Cookies, select the domain and delete its entries.
- Disable extensions. Content blockers and privacy tools can interrupt redirects between the app and the identity provider. The steps for clearing Chrome extension context and cache on a Mac help when one extension keeps stale data.
- Try a second browser. A login that works in Firefox and fails in Chrome points to a cookie or extension rule in the first browser.
- Check cross-site cookies. Chrome keeps third-party cookies available by default, because Google dropped its plan to remove them. Safari, Firefox and Brave block them by default, and Chrome’s Incognito mode blocks them as well.
The last point matters for testing. A login that depends on a cross-site cookie can fail in a private window and still work in a normal Chrome window. A private window is a good first test, and the result needs to be read with that limit in mind.
Software that signs in for the user adds another failure point. A browser agent reuses saved sessions, so an expired session stops the agent in the same way it stops a person.
Network, Firewall and IP Rules
Some accounts accept logins only from approved IP addresses. A new office, a hotel network or a VPN changes the address that the vendor sees, and the login then fails with correct credentials.
- Open the vendor status page first. An outage in the authentication service cannot be fixed from the user side.
- Disable the VPN and try again, then test on a mobile hotspot.
- Ask the administrator whether an IP allowlist is active under the security settings.
- Confirm that the company firewall allows outbound HTTPS to the identity provider and to the SaaS domain.
- Respect a 429 response. The
Retry-Afterheader gives the wait time.
Identity Providers Compared
A team that builds its own SaaS product, or that is choosing a login provider, can compare a few vendors on single sign-on and free limits. Plans change often, so the figures below come from vendor pages and documentation checked on 15 November 2026.
| Provider | Built for | Enterprise single sign-on | Free tier |
|---|---|---|---|
| Auth0 | Customer-facing apps | SAML and OIDC enterprise connections; the free plan includes one | Up to 25,000 monthly active users |
| Okta Workforce | Staff logins | SSO and MFA in annual workforce plans | No free production plan; the Integrator Free Plan is non-production, for up to 10 active users |
| Firebase Authentication | Apps on Google Cloud | SAML (web only) and OIDC after the upgrade to Identity Platform | See the Firebase pricing page for the current allowance |
| Clerk | Developer-first web apps | Enterprise SSO on paid plans | Clerk’s own pricing article lists 50,000 monthly retained users on the free plan since February 2026 |
| Supabase Auth | Apps built on Postgres | SAML 2.0 on paid plans, with 50 SSO users included on Pro | 50,000 monthly active users; basic MFA included |
Clerk bills monthly retained users, while Auth0 and Supabase bill monthly active users. Several third-party pages still list the older 10,000-user figure for Clerk.
Prevention
- Store backup codes in a password manager. A mailbox or a loose note is a poor place for them.
- Use one identity provider where possible. Fewer providers mean fewer certificates, callback addresses and sessions to maintain.
- Add certificate expiry dates to a shared calendar. An expired SAML certificate stops every user at once.
- Build token refresh into every integration. A job that fails silently at night is harder to diagnose than one that logs the refresh error.
- Send authentication failures from audit logs to a team channel. The administrator then sees a pattern before users report it.
- Confirm identity carefully during account recovery. Fraud against recovery processes is a growing problem, which the article on deepfakes, fraud and digital identity describes.
When to Contact Support
Some problems have no fix on the user side. Send support the exact error text, the time of the first failure, any recent change of device or network, and a screenshot of the failed request from the Network tab.
| Situation | Fix without support? | Who to contact |
|---|---|---|
| Lost two-factor device and no backup codes | No | Vendor support, which will verify identity |
| Account suspended for billing | Partly | Vendor billing team or the account owner |
| SAML certificate expired | Yes | The identity provider administrator |
| IP allowlist blocks a new location | Partly | Company IT and the SaaS administrator |
| OAuth app deleted or revoked | Yes | Recreate the app in the developer console |
| Vendor-wide authentication outage | No | Wait and follow the status page |
How This Guide Was Checked
I compared each technical claim with RFC 6749, RFC 6750 and RFC 6238. Vendor figures come from official pricing and documentation pages read on 15 November 2026. The request tests and the one-time password calculation ran in an Ubuntu 24.04 sandbox. Behaviour in other operating systems and vendor consoles may differ, so confirm any fix against the vendor documentation for the product in question.
FAQ
Why does a SaaS login fail with the correct password?
Common causes are a stale cookie, an account that signs in through single sign-on only, a locked account, or a paused workspace. A private window separates browser data from account problems.
What is the difference between a 401 and a 403 error?
A 401 means the server did not accept the credentials or the token. A 403 means the server identified the user and refused the action. Fix a 401 by checking the credential, and fix a 403 by checking the role, scope or IP rule.
How do I fix a redirect_uri_mismatch error?
Copy the redirect address from the app configuration and compare it with the address registered at the provider. Protocol, host, port, path and trailing slash must all match exactly.
Why are my two-factor codes invalid?
The most frequent cause is a device clock that is out of step with the server. Enable automatic time on the phone and enter a fresh code. Use a backup code if the problem continues.
Can a VPN cause authentication to fail?
Yes. A VPN changes the IP address the vendor sees, and an account with an IP allowlist will reject the new address. Disconnect the VPN, or ask the administrator to add its exit address.
What if I lost my two-factor device and have no backup codes?
Contact vendor support or the workspace administrator. Expect an identity check, and expect the time to restore access to vary by vendor.
Check the status page first
A vendor outage looks identical to a local failure. Confirm the service is up before changing any setting.
Conclusion
Authentication errors become manageable once the status code and the error string are read first. Credentials and tokens explain the 401 cases, permissions explain the 403 cases, and clocks explain many two-factor and SAML failures.
Apply the fixes in the order of the login flow: browser, identity provider, second factor, token exchange and API. Keep backup codes, calendar the certificate dates, and test in a second browser or network when a result looks inconsistent.