0
我知道我错过了一些明显的东西,但我无法弄清楚它是什么。我正在尝试做一个简单的“使用Google登录”测试应用程序,在获得Google同意屏幕后,我的网站上会显示403。ASP.NET Core Google登录退货403
在启动时,我配置的cookie和谷歌:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = "Cookies",
AutomaticAuthenticate = true,
AutomaticChallenge = true,
LoginPath = new Microsoft.AspNetCore.Http.PathString("/Account/Login"),
AccessDeniedPath = new Microsoft.AspNetCore.Http.PathString("/Account/Denied")
});
app.UseGoogleAuthentication(new GoogleOptions
{
AuthenticationScheme = "Google",
SignInScheme = "Cookies",
ClientId = "xxx"
ClientSecret = "xxx"
AutomaticChallenge = true
});
我已经配置了谷歌API打端点中间件创建:
但是从谷歌回调http://localhost:5000/signin-google?state=xxxxxxx
给我一个403错误。我的开发人员异常页面显示:
我的登录方法很简单:
[HttpGet("login")]
public IActionResult Login(string returnUrl)
{
return Challenge(new AuthenticationProperties
{
RedirectUri = returnUrl ?? "Home/Index"
});
}
有人可以帮助我与我的硬伤理解?