我使用netcore2.1通过Google登录,尽管返回了票证,但是每次我访问需要[authorize]
的页面时,它仍然会将我重定向到登录页面,而不是我请求的页面
我正在使用我的登录名,然后正确的claims
回来了。
services.AddAuthentication().AddGoogle(options =>
{
options.ClientId = Configuration["Authentication:Google:ClientId"];
options.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
options.Backchannel = new HttpClient(httpClientHandler);
// Provide the Google Client
options.Scope.Add("https://www.googleapis.com/auth/plus.login");
options.SaveTokens = true;
options.Events.OnCreatingTicket = ctx =>
{
List<AuthenticationToken> tokens = ctx.Properties.GetTokens()
as List<AuthenticationToken>;
tokens.Add(new AuthenticationToken()
{
Name = "TicketCreated",
Value = DateTime.UtcNow.ToString()
});
ctx.Properties.StoreTokens(tokens);
return Task.CompletedTask;
};
});
我认为我缺少什么?