# Troubleshooting OpenID Connect errors

> The most common reasons a sign-in fails, and how to fix each one.

_Source: https://id.identvia.com/help/developers/oidc-troubleshooting_

Identvia is strict on purpose. These are the errors developers hit most often.

## “Invalid redirect”

The `redirect_uri` must match a registered one byte for byte: scheme, host, port, path and trailing slash. Identvia stops on its own page instead of redirecting, for your users' safety.

## `invalid_request: PKCE code_challenge is required`

Every client must use PKCE with `code_challenge_method=S256`, including confidential ones.

## `invalid_request: state is required` or `nonce is required`

Apps registered in the developer console must send `state`. Every request with the `openid` scope must send a `nonce`, and your app must check it in the ID token.

## `invalid_scope`

The scope isn't supported or isn't enabled for this environment. Supported scopes are `openid`, `email`, `profile` and `offline_access`, plus the MCP scopes for agent clients.

## `invalid_grant` at the token endpoint

Authorization codes are single-use and expire after about a minute. Reusing a code also revokes every token issued from it. Check you aren't exchanging the same code twice (for example on page reload).

## No refresh token

Refresh tokens are only issued with the `offline_access` scope. They rotate on every use; presenting an old one revokes the whole family.

## ID token rejected

Check the issuer exactly matches the `issuer` in `/.well-known/openid-configuration`, the audience is your client ID, and you fetch keys from the `jwks_uri` (keys rotate).

## Frequently asked questions

### Why is the subject different in staging and production?

It isn't if both use the same host. Pairwise subjects are per site (redirect host), so different hosts get different `sub` values by design.

### Can I use the implicit flow?

No. Only the authorization code flow with PKCE is supported.
