我正在尝试使用Instagram作为.Net Core 2.0应用程序中的外部登录提供程序进行身份验证。 我的中间件配置如下所示: Startup.cs
services.AddAuthentication().AddInstagram(options =>
{
options.ClientId = ApplicationSettings.InstagramSettings.ApplicationId;
options.ClientSecret =ApplicationSettings.InstagramSettings.ApplicationSecret;
options.Scope.Add(ApplicationSettings.InstagramSettings.Permissions);
options.SaveTokens = true;
});
AccountController中的ExternalLogin方法未更改:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public IActionResult ExternalLogin(string provider, string returnUrl = null)
{
// Request a redirect to the external login provider.
var redirectUrl = Url.Action(nameof(ExternalLoginCallback), "Account", new { returnUrl });
var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl);
return Challenge(properties, provider);
}
然而,当
var info = await _signInManager.GetExternalLoginInfoAsync();
在ExternalLoginCallback()中调用,结果为null。
注意:
有什么想法吗?
答案 0 :(得分:2)
我使用的Instagram OAuth提供程序版本中存在一个错误(2.0.0-rc2-final),可防止正确处理用户信息响应。 我切换到修复错误的软件包的最新RTM每晚版本。