.net core 身份服务器4上的关联失败

.net core 身份服务器4上的关联失败,.net-core,oauth-2.0,identityserver4,.net Core,Oauth 2.0,Identityserver4,我有一个身份服务器4,配置了OpenIdConnect到Azure AD 当用户单击登录按钮时,IS4将重定向到Azure AD,并在回调到IS4时显示此错误: 以下是我向邮递员申请代币的方式: 请注意,回调url是移动应用程序格式 这是我的配置: services.AddAuthentication() .AddCookie(选项=>新CookieAuthenticationOptions { ExpireTimeSpan=从小时(12)开始的时间跨度, slidengexpiration

我有一个身份服务器4,配置了OpenIdConnect到Azure AD

当用户单击登录按钮时,IS4将重定向到Azure AD,并在回调到IS4时显示此错误:

以下是我向邮递员申请代币的方式:

请注意,回调url是移动应用程序格式

这是我的配置:

services.AddAuthentication()
.AddCookie(选项=>新CookieAuthenticationOptions
{
ExpireTimeSpan=从小时(12)开始的时间跨度,
slidengexpiration=false,
Cookie=新CookieBuilder
{
路径=”,
Name=“MyCookie”
}
}).AddOpenIdConnect(选项=>
{
options.ClientId=configuration[“OpenIdConnect:ClientId”];
options.Authority=configuration[“OpenIdConnect:Authority”];
options.SignedOutRedirectUri=配置[“OpenIdConnect:PostLogoutRedirectUri”];
options.CallbackPath=配置[“OpenIdConnect:CallbackPath”];
options.ResponseType=OpenIdConnectResponseType.CodeIdToken;
options.Resource=configuration[“OpenIdConnect:Resource”];
options.ClientSecret=配置[“OpenIdConnect:ClientSecret”];
options.SaveTokens=true;
options.RequireHttpsMetadata=false;
options.TokenValidationParameters=新的TokenValidationParameters
{
NameClaimType=“name”,
RoleClaimType=“角色”
};
options.signnscheme=IdentityServerConstants.ExternalCookieAuthenticationScheme;
});
这是我的参数:

  "OpenIdConnect": {
    "ClientId": "xxxxxxxxxx",
    "Authority": "https://login.microsoftonline.com/xxxxxxxxxx/",
    "PostLogoutRedirectUri": "https://uri-of-my-identity-server.azurewebsites.net",
    "CallbackPath": "/signin-oidc",
    "ResponseType": "code id_token",
    "Resource": "https://graph.microsoft.com/",
    "ClientSecret": "my-secret"
  },

注意:此错误仅在Azure环境中发生(非本地)

注意:在Xamarin应用程序上,当Azure返回IS4同意屏幕时,会显示以下消息:


可能是您的客户端和Azure之间的网络存在问题。某个端口尚未打开,或者负载平衡器位于两者之间

When decryption fails, state is null, thus resulting in a Correlation failed: state not found error. In our case, decryption failed because different keys were used for encryption/decryption, a pretty common problem when deploying behind a load balancer.

您可以尝试将回调路径更改为
/signin oidc aad
,并将aad应用程序重定向url修改为
https://uri-of-my-identity-server.azurewebsites.net/signin-oidc-aad
@NanYu I配置了新url(带有-aad字符串)在我的IS4参数和Azure AD配置上,但我遇到了相同的错误AuthenticationController回调的代码在哪里?你厌倦了吗