我試圖用我的應用程序連接到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,但是使用了新的門戶。我無法訪問經典門戶。
如何解決此錯誤?
謝謝你的幫助。
您是否修復了此問題? –