例外:关联失败。未知位置异常:处理远程登录时遇到错误

时间:2020-08-14 17:42:49

标签: c# asp.net-core .net-core google-authentication

突然我的ASP.NET Core 3.1应用程序无法使用Google身份验证

  services.AddAuthentication()
                    .AddGoogle(opts =>
                {
                    opts.ClientId = Configuration.GetSection("GoogleLogin").GetSection("ClientId").Value;
                    opts.ClientSecret = Configuration.GetSection("GoogleLogin").GetSection("ClientSecret").Value;
                    opts.Events = new OAuthEvents
                    {
                        OnCreatingTicket = context =>
                        {
                            var profileUrl = context.User.GetProperty("picture").ToString();
                            context.Identity.AddClaim(new Claim("picture", profileUrl));
                            return Task.FromResult(0);
                        }
                    };
                });

0 个答案:

没有答案