Identityserver4使用两个相同的外部提供程序,第二个外部提供程序登录始终失败

Identityserver4使用两个相同的外部提供程序,第二个外部提供程序登录始终失败,identityserver4,discord.net,Identityserver4,Discord.net,我使用两个具有不同clientid的discord provider进行登录。代码如下: services.AddAuthentication() .AddDiscord("ADiscord", u => { u.ClientId = "74627xxx8536"; u.ClientSecret = &quo

我使用两个具有不同clientid的discord provider进行登录。代码如下:

services.AddAuthentication()
                .AddDiscord("ADiscord", u =>
                {
                    u.ClientId = "74627xxx8536";
                    u.ClientSecret = "B-FLxxxxjp3JOKwr27";
                    u.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                    u.Scope.Add("guilds.join");
                    u.SaveTokens = true;
                    u.CorrelationCookie.SameSite = SameSiteMode.Unspecified;
                    u.CorrelationCookie.IsEssential = true;
                })
                .AddDiscord("BDiscord", u =>
                {
                    u.ClientId = "71475xxx1925";
                    u.ClientSecret = "45-xxxA4okXx1I";
                    u.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                    u.Scope.Add("guilds.join");
                    u.SaveTokens = true;
                    u.CorrelationCookie.SameSite = SameSiteMode.Unspecified;
                    u.CorrelationCookie.IsEssential = true;
                });
当我使用scheme“ADiscord”登录时,一切正常。但是使用scheme“BDiscord”它会抛出一个错误“远程身份验证错误:oauth状态丢失或无效”。 更奇怪的是,如果更改顺序,让“BDiscord”位于顶部,然后使用scheme“BDiscord”登录,一切正常,“ADiscord”将抛出错误


Disord提供程序代码处于启用状态,您需要设置,将其设置为类似于
/signin discord
,并使用IdSvr4注册
/signin discord
。此终结点用于在重定向到应用程序终结点之前完成OAuth握手。

OMG…成功了..我被此问题困扰了两天..thx