api auth_error ai_generated true

OAuth2 error: redirect_uri_mismatch

ID: api/oauth2-invalid-redirect-uri-mismatch

Also available as: JSON · Markdown · 中文
90%Fix Rate
88%Confidence
1Evidence
2023-06-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
OAuth 2.0 RFC 6749 active
Google OAuth 2.0 active
Auth0 v3.0 active

Root Cause

The redirect URI in the authorization request does not exactly match one registered in the OAuth client configuration.

generic

中文

授权请求中的重定向 URI 与 OAuth 客户端配置中注册的 URI 不完全匹配。

Official Documentation

https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2

Workarounds

  1. 95% success Copy the exact redirect URI from the OAuth provider's client settings page and paste it into your application code.
    Copy the exact redirect URI from the OAuth provider's client settings page and paste it into your application code.
  2. 85% success Ensure the redirect URI does not have query parameters or fragments unless explicitly allowed.
    Ensure the redirect URI does not have query parameters or fragments unless explicitly allowed.

中文步骤

  1. Copy the exact redirect URI from the OAuth provider's client settings page and paste it into your application code.
  2. Ensure the redirect URI does not have query parameters or fragments unless explicitly allowed.

Dead Ends

Common approaches that don't work:

  1. 50% fail

    The mismatch is often a missing trailing slash or different casing; adding one may not fix if the registered URI lacks it.

  2. 90% fail

    Most OAuth providers do not allow wildcards for security reasons.

  3. 100% fail

    The error is deterministic; retrying without fixing the URI pattern will always fail.