AuthenticationManager.GetExternalLoginInfoAsync()始终为空

weixin_38079044 2019-09-12 04:14:46

ExternalLoginInfo loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(); 为什么这行总是返回null?它发生在用户尝试使用任何提供者登录时。我知道FLOW是正确的,因为它实际上在本地工作,但是当我部署网站时,它总是返回null。 从我所了解的情况来看,它使用外部cookie来跟踪这一点,我可以确定它不是浏览器,因为它在本地工作在同一浏览器上。 即使我已经仔细检查了所有提供者在每个相应的控制面板中都具有“允许”域,也会发生这种情况。就像我说的一切都在当地工作。 我试过重新启动IIS,因为一些答案建议。 也有这些线Startup.Auth.cs与cookie DOMIAN正确设置 app.UseCookieAuthentication(new CookieAuthenticationOptions { CookieDomain = ".example.com", ... }); //use a cookie to temporarily store information about a user logging in with a third party login provider app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);






...全文
97 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
weixin_38104003 2019-09-12
  • 打赏
  • 举报
回复

确保您(Facebook,微博等)供应商设置未覆盖的部署。 此外请确保您的回调网址在提供商处正确注册。我正在使用LinkedIn,需要一个完整的URL到你的回调,例如。 https://domain.com/signin-linkedin 我有以下设置,这没有任何问题的工作: app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, CookieSecure = CookieSecureOption.SameAsRequest, CookieName = "CustomCookieName", LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, User>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => Some.Custom.Identity.Helper.GenerateUserIdentityHelperAsync(user, manager)) // This helper method returns ClaimsIdentity for the user } }); app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

433

社区成员

发帖
与我相关
我的任务
社区描述
其他技术讨论专区
其他 技术论坛(原bbs)
社区管理员
  • 其他技术讨论专区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧