簡體   English   中英

Blazor Webassembly Azure AD 身份驗證托管在 Azure 存儲帳戶中

[英]Blazor Webassembly Azure AD authentication hosted in Azure storage account

According to instruction described in “Secure an ASP.NET Core Blazor WebAssembly standalone app with Azure Active Directory” https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-azure-active -directory?view=aspnetcore-3.1我創建了最簡單的 blazor webassembly 應用程序。 https://portal.azure.com我在 AAD 中注冊了新應用程序,並根據生成的 GUID 使用以下命令生成本地應用程序:

dotnet new blazorwasm -au SingleOrg --client-id "{CLIENT ID}" --tenant-id "{TENANT ID}" -o {APP NAME}

如果我在本地啟動應用程序,一切正常。 如果我將已發布的應用程序復制到存儲帳戶 $web 並嘗試登錄,我會收到:

AADSTS50011:請求中指定的回復 URL 與為應用程序配置的回復 URL 不匹配:“...”。

During app registration I have defined app as “Web” and put Redirect URL: https://localhost:5001/authentication/login-callback I have tried different combinations of URL changing hostname, deleting port and changing path. 我不知道如何在 AD 中成功配置應用程序。

The AAD error states that the URL which you are getting redirected is not present in the reply url list configured in the app registration.You need to register a reply url in the format - {WebsiteUrl}/authentication/login-callback.
請試一試,希望能解決問題。
注意-WebsiteUrl 是托管在 azure 中的 Url

根據上面的答案和評論,我采取了兩個步驟來解決這個問題:

  1. Azure AD 必須在App 注冊中有條目 | 認證 | 單頁申請 | 重定向讀取{WebsiteUrl}/authentication/login-callback URI。 {WebsiteUrl}來自存儲帳戶 | Static 網站 | 主要終點

  2. 確保存儲帳戶 | Static 網站 | 索引文檔名稱錯誤文檔路徑指向index.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM