身份服务器4:如何添加Instagram登录工作流

问题描述 投票:0回答:1

我已经阅读了很多文档,并且已经通过Twitter,Google,Facebook登录/注册工作流程成功实现了IS4。

但是我在实施Instagram时遇到很多问题。我已经在启动时添加了:

.AddOpenIdConnect("oidc", "Instagram", options =>
           {
               options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
               options.SignOutScheme = IdentityServerConstants.SignoutScheme;
               options.SaveTokens = true;
               options.ClientId = "xxxxxxxxxxxxxxxxxxxxx";
               options.ClientSecret = "yyyyyyyyyyyyyyyyyyyyyyyyy";
               options.Authority = "https://api.instagram.com/oauth/authorize/";

               options.TokenValidationParameters = new TokenValidationParameters
               {
                   NameClaimType = "name",
                   RoleClaimType = "role"
               };
           });

我在IS4的示例项目中实现了与Google相同的“ InstagramAuthProvider”。从现在开始,我无法启动登录流程,因为我遇到该错误:

[处理请求时发生未处理的异常。 HttpRequestException:响应状态代码不指示成功: 404(未找到)。 System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()

IOException:IDX20804:无法从以下位置检索文档:'[PII是 隐]'。 Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(string 地址,CancellationToken取消)

InvalidOperationException:IDX20803:无法获取配置 来自:“ [PII隐藏]”。 Microsoft.IdentityModel.Protocols.ConfigurationManager.GetConfigurationAsync(CancellationToken 取消)

我真的没有发现有用的东西,可能没有人在IS4中实现Instagram吗?有什么建议吗?我完全被卡住了。

oauth-2.0 instagram identityserver4
1个回答
0
投票

您可以将Instagram身份验证提供程序用于ASP.NET Core here

  1. 安装AspNet.Security.OAuth.Instagram nuget包

  2. 添加代码:

AspNet.Security.OAuth.Instagram
  1. 读取services.AddAuthentication() .AddInstagram( options => { options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme; options.ClientId = "client-Id"; options.ClientSecret = "client-secret"; }); 以设置参数

阅读更多Instagram instructions

© www.soinside.com 2019 - 2024. All rights reserved.