[英]ASP.NET Core Google Sign In Returns 403
我知道我缺少明显的东西,但是我无法弄清楚它是什么。 我正在尝试制作一个简单的“使用Google登录”测试应用,当我获得Google同意屏幕后,在我的网站上显示403。
在启动中,我配置Cookie和Google:
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
});
我已经将google api配置为击中中间件创建的端点:
但是从Google到http://localhost:5000/signin-google?state=xxxxxxx
的回调给了我403错误。 我的开发人员例外页面显示:
我的登录方法很简单:
[HttpGet("login")]
public IActionResult Login(string returnUrl)
{
return Challenge(new AuthenticationProperties
{
RedirectUri = returnUrl ?? "Home/Index"
});
}
有人可以帮助我了解我的错误吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.