来自 github 的授权回调 URL 不起作用,循环同一页面



所以我正在建立一个网站,要求用户经过github认证,以便通过netify cms创建和发布博客文章。

所以在 GitHub 中,我添加了应用程序。

主页设置为:

https://example.netlify.com  

为了到达网站的管理区域以发布博客等,用户必须导航到

通过 github https://example.netlify.com/admin/和进行身份验证。

现在身份验证部分正在工作,我正在登录我的 GitHub 帐户,但它循环回 OAuth 页面,但有一个奇怪的 URL:

https://example.netlify.com/admin/?error=redirect_uri_mismatch&error_description=The+redirect_uri+MUST+match+the+registered+callback+URL+for+this+application.&error_uri=https%3A%2F%2Fdeveloper.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23redirect-uri-mismatch&state=5d971eb88a5073cf804e90d5#/collections/blog

我已将授权回调 URL 设置为:

https://example.netlify.com/admin/#/collections/blog

这是用户应该登录的地方,以便发布博客和文章

那么为什么它一直循环呢? 我显然设置了一个不正确的字段,我假设我的授权回调 URL 不正确?

错误 = redirect_uri_mismatch error_description=The+redirect_uri+MUST+match+the+register+callback+URL+for+this+application。 error_uri=https%3A%2F%2Fdeveloper.github.com%2Fapps%2Fmanaging-oauth-apps%2Ftroubleshooting-authorization-request-errors%2F%23redirect-uri-mismatch

此错误消息中的主要线索是redirect_uri_mismatch如果您将其用作Google,您将开始了解问题。 身份服务器的部分安全性是,必须在 idnetiy 服务器本身上注册 Redirct URI,即身份服务器返回您的授权的重定向 URI。 某人不能只代表您的应用程序发送请求并在自己的网站上获得授权。

因此,您在应用程序中发送的任何重定向 uri 都需要在 Github 上注册才能获得授权。 目前没有。

您可以在此处阅读有关它的更多信息 排查 OAuth 应用程序访问令牌请求错误

最新更新