问题标签 [google-oauth-.net-client]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
27 浏览

asp.net-mvc - 有没有办法覆盖 CallbackPath 以包含该方案?

使用 OAuth 2.0,我们将我们的应用程序设置为使用 Google 作为外部登录名,并且一切正常,直到 Google 发生了一些变化,现在它抱怨:

您无法登录此应用,因为它不符合 Google 用于确保应用安全的 OAuth 2.0 政策。

我认为这里的问题是,虽然我们redirect_url在 Google 控制台中设置了 to https://ourwebsite.com/signin-google,但我们的服务器位于负载均衡器后面,负载均衡器和实际服务器之间的连接是http(因为它完全是一个内部网络)与提供https给外部世界的负载均衡器。这在以前没有引起问题,但现在看来它不起作用。

所以谷歌似乎看到了redirect_urlhttp://ourwebsite.com/signin-google拒绝了它。我们试图强制它按照这样的方案发送redirect_urlwith https

但这会抱怨,因为:

The path must start with a '/' followed by one or more characters.

换句话说,您不能在那里放置完全合格的路径。那么有没有办法redirect_url在它被发送到谷歌来纠正这个方案之前改变它?

这是 Google 错误的屏幕截图,显示 Google 将其redirect_uri视为http

在此处输入图像描述

更新:

我尝试将其添加到Startup.Auth.cs

而且,令人惊讶的是,它让我通过了 Google 身份验证错误。不幸的是,然后我被重定向到https:///ourwebsite.com/Account/ExternalLoginCallback?error=access_denied,我不确定为什么。我怀疑它可能在返回的令牌中存在某种不匹配,因为它是 forhttps并且后端仍在将它与http? 有没有解决的办法?