api auth_error ai_generated true

OAuth2 错误:redirect_uri_mismatch

OAuth2 error: redirect_uri_mismatch

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

其他格式: JSON · Markdown 中文 · English
90%修复率
88%置信度
1证据数
2023-06-15首次发现

版本兼容性

版本状态引入弃用备注
OAuth 2.0 RFC 6749 active
Google OAuth 2.0 active
Auth0 v3.0 active

根因分析

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

English

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

generic

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 50% 失败

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

  2. 90% 失败

    Most OAuth providers do not allow wildcards for security reasons.

  3. 100% 失败

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