0

私のアプリケーションでAzure Active Directoryに接続しようとしていますが、このエラーが発生します。 要求の処理中に未処理の例外が発生しました。OpenIdConnectAuthenticationHandler:message.Stateがnullまたは空です。 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ファイルは次のようになります。私は私のプロジェクトでSSLを有効にし、そのビジュアルのURLを追加しました

"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"] 
    }); 

でスタジオは私を返信URLとして提供します。

誤ったURLが設定されていたときは、URLが登録済みのものと一致しないと言われたMicrosoftのログインサイトにつながってしまいました。

私はthis postをフォローしていたが、新しいポータルを使用していたとも言える。私は古典的なポータルにアクセスできない。

このエラーを解決するにはどうすればよいですか?

ありがとうございました。

+0

この問題は修正されましたか? –

答えて

0

new register apps portalの代わりにnew Azure portal を指定してください。これはAzure AD v2.0 endpointです。

Before, when I had an incorrect URL configured, it led me to the Microsoft login site that said that the URL didn't match any registered ones, so I know it at least got that far.

コードで使用しているredirect_urlは、Azureに登録するアプリケーション用に設定する必要があります。

また、私はこのリンクをたどり、プロジェクトはうまく機能します。プロジェクトはhereからダウンロードできます。最初にAzureのアプリケーションのredirect_url(https://localhost:44397/signin-aad)を設定し、アプリに基づいてアプリ設定を設定すると、URLを使用してアプリにアクセスできますhttps://localhost:44397

関連する問題