Instagram OAuth 提供商 - 身份验证问题
Instagram OAuth Provider - Authentication issue
我正在尝试使用 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() 中被调用,结果为空。
注意:
- 这对于 Facebook 提供商来说工作得很好,中间件配置中没有其他设置。
- 如果我在 Fiddler 中检查网络 activity,我可以看到 Instagram 已成功将 access_token 发送回我的应用程序,只是 GetExternalLoginInfoAsync() 无法读取它。
有什么想法吗?
我使用的 Instagram OAuth 提供程序版本 (2.0.0-rc2-final) 中存在错误,导致无法正确处理用户信息响应。
我切换到修复了错误的包的最新 RTM 每晚构建。
我正在尝试使用 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() 中被调用,结果为空。
注意:
- 这对于 Facebook 提供商来说工作得很好,中间件配置中没有其他设置。
- 如果我在 Fiddler 中检查网络 activity,我可以看到 Instagram 已成功将 access_token 发送回我的应用程序,只是 GetExternalLoginInfoAsync() 无法读取它。
有什么想法吗?
我使用的 Instagram OAuth 提供程序版本 (2.0.0-rc2-final) 中存在错误,导致无法正确处理用户信息响应。 我切换到修复了错误的包的最新 RTM 每晚构建。