---
title: SSO troubleshooting
description: What each SSO refusal means and how to fix it.
canonical_url: 'https://saaslayer.com/docs/users/sso-troubleshooting/'
last_updated: '2026-11-22T17:01:19-08:00'
---
# SSO troubleshooting

What each SSO refusal means and how to fix it. Names are provisional until the SSO naming review.

Every SSO sign-in checks with the identity provider, even right after a sign-out or another person's sign-in in the same
browser. A person signed out of the provider, or disabled there, is asked to sign in there again.

## Where to find the reason

* **The browser.** A refused sign-in comes back to the app's callback as an OAuth error whose description contains
  `SSO_SIGNIN_REFUSED: <reason>`. The reason is a code, never a value from the provider.
* **The audit trail.** `saaslayer sso audit <connectionId> --type sign-in.refused` lists each refused sign-in with a
  `refused: <reason>` line (`details.reason` with `--json`). A refused SCIM request (`--type scim.request`) shows its
  method, resource, status, `scimType` and detail the same way.
* **Health.** `saaslayer sso status <connectionId>` shows `health: failing` and an `issue: login-failure` with the
  categories that failed since the last success, and a `refused: <reason>` line for each reason.
* **The identity provider's own page.** Errors such as `invalid_scope` or `AADSTS65004` never reach SaaSLayer: the
  provider shows them, or returns them to Cognito before any SSO check runs.

## The common ones

These are the refusals testing hit or that setup gets wrong most often.

| Reason | What it means | Fix |
| --- | --- | --- |
| `domain-mismatch` | The provider's email is outside every domain listed on the connection. Typical: Entra users whose only address is `…onmicrosoft.com`, a contractor's own domain, a personal Gmail account. | Give the people an email in a domain you add and verify on the connection; in Entra that is a verified custom domain set as their **Email**. Contractors are invited by email and use native sign-in. |
| `email-domain-unverified` | The email's domain is listed on the connection but its DNS proof isn't verified yet (or was demoted after 14 days of failing checks). | Publish `_saaslayer-sso.<domain>` and run `saaslayer sso domains verify <connectionId> <domain>`. |
| `email-shaped-subject` | The subject (SAML NameID, or the id the subject source points at) looks like an email. Emails can change and be reused, so they never identify anyone. | Okta SAML: **Application username** **Custom** `user.getInternalProperty("id")`, **Name ID format** **Persistent**, then re-apply the app's assignments. Entra SAML: Name ID `user.objectid`, **Persistent**. |
| `not-associated` | Cognito issued a token for a provider credential that has no active SaaSLayer identity behind it: the identity was removed, or the inbound sign-in that should have created it didn't run or was refused. | Sign in again from the start (not a refresh). If it repeats for every person, check that the deployment runs the current user-service release: older releases missed the association on pools that lowercase federated usernames. |
| `subject-case-conflict` | Two subjects on the connection differ only in letter case. The pool folds usernames to lower case, so SaaSLayer can't tell them apart and refuses rather than guess. | Use a case-stable immutable id as the subject: the Okta user id, the Entra object id, Google's `sub`. A NameID template that changes case between sign-ins causes this. |
| `invalid_scope` (Okta) | The connection asks for a scope the Okta authorization server doesn't define, usually `groups`. Okta shows it before any SSO check. | Okta: **Security → API → Authorization Servers → \<server> → Scopes → Add Scope** `groups`. Or drop `--oidc-scope groups` from the connection. |
| `consent_required` / `AADSTS65004` (Entra) | The person was asked to consent to the app and couldn't, or declined (`AADSTS65004`). | Entra: **App registrations → \<app> → API permissions → Grant admin consent for \<tenant>**. |

## Groups are incomplete

An incomplete group list never fails the sign-in. It grants nothing from groups: no mapping rule, no default grant, no
manager group. The ID token shows it as `sso_groups` `"[]"` with `sso_groups_truncated` `"true"`, which a reader
(`readSsoClaims`) returns as `groups: null`. The person's groups are recomputed at their next sign-in.

| Reason | What it means | Fix |
| --- | --- | --- |
| `groups-missing` | The sign-in carried no groups claim or attribute at all. | Okta OIDC: a `groups` claim on the **ID token**. Okta SAML: a `groups` group attribute statement. Entra: **Add groups claim** / **Add a group claim**. |
| `groups-overage` | Entra left the list out because the person is in too many groups (OIDC `_claim_names`/`hasgroups`, SAML `…/claims/groups.link`). | Limit the claim to **Groups assigned to the application**, or turn SCIM on and confirm its first sync. |
| `groups-truncated` | The provider marked its list as partial. | Narrow the groups the provider sends, or use SCIM. |
| `groups-too-many` | More than 500 groups. | Filter the groups claim to the ones your mappings use. |
| `groups-malformed` | The list isn't a list of non-empty strings of at most 256 characters. | Send plain group names or ids. |

A complete list longer than 50 groups or 2,048 bytes is capped **in the token** and marked truncated there, while the
stored set stays complete and Permissions decides from it. Google sends no groups: its `sso_groups` is `"[]"` with
`sso_groups_truncated` `"false"`, complete and empty.

## Every refusal reason

### Domains

| Reason | Meaning and fix |
| --- | --- |
| `domain-mismatch` | Email outside the connection's domains. See above. |
| `email-domain-unverified` | Email's domain listed but not verified. See above. |
| `hosted-domain-unverified` | Google: the signed `hd` claim is missing or names no verified domain, for example a personal Google account registered with a work address. Sign in with the Workspace account. |
| `adoption-domain-unverified` | The first sign-in would join an existing account, but that account's email domain stopped being verified on the connection meanwhile. Re-verify the domain and sign in again. |

### The provider and the connection don't match

| Reason | Meaning and fix |
| --- | --- |
| `issuer-mismatch` | The token's issuer isn't the connection's. Okta: use the authorization server's issuer (`…/oauth2/<server>`), never the bare domain. Entra: the tenant-specific `…/<tenant id>/v2.0`. The issuer locks at activation; a wrong one needs a new connection. |
| `audience-mismatch` | The ID token's audience isn't the connection's OIDC client id. Check the client id on the connection. |
| `tenant-mismatch` | Entra: the sign-in came from another tenant than the connection's pinned `providerTenant`, or (SAML) the tenant id differs in case. Set the tenant id exactly as Entra sends it (lower case). |
| `tenant-missing` | The subject source is `oid` but the token carries no `tid`. Only Entra sends one: use `--subject-source sub` for other providers. |
| `protocol-mismatch` | The provider's protocol differs from the connection's. Recreate the connection with the right `--protocol`. |
| `namespace-mismatch` | An existing identity was created under a different issuer, tenant or subject source than the connection has now. The namespace is fixed after activation; use a new connection for a new namespace. |

### The subject

| Reason | Meaning and fix |
| --- | --- |
| `email-shaped-subject` | The subject looks like an email. See above. |
| `subject-case-conflict` | Two subjects differ only in case. See above. |
| `subject-mismatch` | The ID token's `sub` isn't the subject Cognito reported. Usually a provider attribute mapping that rewrites the username; remove it. |
| `subject-invalid` | The subject is empty, longer than 256 characters, or contains whitespace or control characters. Use the provider's immutable id. |
| `directory-id-invalid` | The directory id is unusable: for Entra `oid`, not a GUID; otherwise empty, too long or containing whitespace. Check the subject source (`oid` for Entra OIDC). |
| `subject-conflict` | The same subject already belongs to a different directory identity on this connection, or an identity's subject changed. The provider reused or changed a user's id; fix it in the provider. |
| `identity-conflict` | The person already holds a different identity on this connection, so a second one (for example a recycled email) can't join them. Remove the stale identity first. |
| `credential-conflict` | The Cognito credential already belongs to another person. Contact support with the connection id. |
| `credential-missing` | Cognito's token request carried no credential `sub`. Retry; if it repeats, contact support. |
| `not-associated` | No active identity behind the credential. See above. |
| `email-missing` | No usable email: OIDC needs an `email` claim (or userinfo email) and the `email` scope; SAML needs an attribute named `email` or Entra's `emailaddress` claim. |
| `evidence-missing` | Cognito passed no ID token or SAML attributes to the sign-in check. Retry; if it repeats, check the provider's attribute mapping. |

### Provisioning and the person's state

| Reason | Meaning and fix |
| --- | --- |
| `not-provisioned` | The connection is SCIM-only (`--jit off`) and SCIM hasn't provisioned this person. Assign them in the provider and let SCIM push them, or turn JIT on. |
| `inactive` | The person was deactivated (SCIM `active:false`, or a deprovisioning). Reactivate them in the provider (SCIM), or `saaslayer sso reactivate <connectionId> --directory-id <id> --reason …` when SCIM doesn't manage the connection. |
| `deleted` | The person's identity was deleted (SCIM `DELETE`). Re-provision them; they come back with a new SCIM id and no groups until the provider pushes them. |
| `re-provisioned` | Not a refusal: the status reason recorded when SCIM provisions a deleted or deactivated person again. |
| `required-groups` | A health category reserved for a required-groups gate; no sign-in is refused with it in this release. |

### The connection and the service

| Reason | Meaning and fix |
| --- | --- |
| `connection-unknown` | The sign-in names a connection that doesn't exist (deleted, or a stale provider in Cognito). Remove the person's bookmark or tile, and check `saaslayer sso list`. |
| `connection-unavailable` | The connection is disabled or being deleted. `saaslayer sso activate <connectionId>` trusts it again. |
| `contention` | Several first sign-ins of the same person raced and didn't settle. Sign in again. |
| `writes-frozen` | The instance is in a write freeze (for example during a migration). Only people who already signed in through this connection get in; new people are refused until the freeze ends. |
| `unavailable` | A health category for refusals caused by the service being unavailable. Retry; if it persists, check the instance's health. |

### Signature, clock and certificate

Cognito validates a SAML response's signature and validity window, and an OIDC token's signature, before SaaSLayer
sees the sign-in. A failure there comes back as Cognito's own error, not as `SSO_SIGNIN_REFUSED`. The health report
reserves these categories for them:

| Reason | Meaning and fix |
| --- | --- |
| `signature-invalid` | The response isn't signed by a certificate in the connection's metadata. Reload the metadata: `saaslayer sso rotate-secret <connectionId> --metadata-url …`. |
| `certificate-expired` | Every signing certificate in the metadata has expired. Activate a new certificate in the provider, then rotate the metadata. Alerts arrive at 90, 30, 7 and 1 days. |
| `assertion-expired` | The assertion's validity window passed before it reached Cognito. Retry; check the provider's assertion lifetime. |
| `clock-skew` | The provider's clock is off. Fix the provider's time source. |

## Errors from setup and management

| Error | What it means | Fix |
| --- | --- | --- |
| `SSO_DOMAIN_CLAIMED` | Another connection on the deployment owns the domain. A domain belongs to one connection at a time. | `saaslayer sso domains remove <other> <domain>`, then add and verify it on this one. |
| `record-missing` / `record-mismatch` | `sso domains verify` found no TXT record, or a different value. | Publish `_saaslayer-sso.<domain>` exactly as `sso status` shows it; with a TTL of 300 it propagates within minutes. |
| `SSO_IDENTITY_NAMESPACE_IMMUTABLE` | The issuer, subject source, provider tenant or OIDC client id changed after activation. | Create a new connection. |
| `SSO_EMAIL_SENDER_REQUIRED` | Domain enforcement or a break-glass list was set on a deployment with no email sender. Enforcement notices and break-glass codes are emailed, so without a sender an identity-provider outage would lock the domain out. | Verify an address or domain in Amazon SES in the deployment's account, then `saaslayer deployment settings set --set user-service.CognitoEmailFromAddress=<address>`, and turn enforcement on again. |
| `redirect_uri_mismatch` (Google) / `AADSTS50011` (Entra) | The provider's registered redirect URI differs from the connection's. | Register the URI `sso status` shows. After a login-domain switch, register the new one beside the old. |
