我试图用我的应用程序连接到Azure Active Directory,但出现此错误: 处理请求时发生未处理的异常。OpenIdConnectAuthenticationHandler:message.State为空或空。当连接到Azure Active Directory
Exception: OpenIdConnectAuthenticationHandler: message.State is null or empty. Unknown location
AggregateException: Unhandled remote failure. Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.d__5.MoveNext()
我appsettings.json文件看起来像这样:
"AzureAd": {
"ClientId": "<Application ID value from Azure Portal>",
"AadInstance": "https://login.microsoftonline.com/{0}",
"TenantId": "<tenant>.onmicrosoft.com",
"AuthCallback": "/"
}
和Startup.cs
app.UseCookieAuthentication();
app.UseIdentity();
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = Configuration["AzureAd:ClientId"],
Authority = string.Format(Configuration["AzureAd:AadInstance"], Configuration["AzureAd:TenantId"]),
CallbackPath = Configuration["AzureAd:AuthCallback"]
});
我启用了SSL,在我的项目,并添加URL中的可视化Studio将我作为回复URL。
之前,当我不得不配置一个不正确的URL,这使我对Microsoft登录网站,称该URL没有任何注册的名称相符,所以我知道它至少得那么远。
我也应该说我正在关注this post,但是使用了新的门户。我无法访问经典门户。
如何解决此错误?
谢谢你的帮助。
您是否修复了此问题? –