[英]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 I have created the simplest blazor webassembly app. 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 应用程序。 At https://portal.azure.com I registered new app in AAD and based on generated GUIDs generated local app with this command:
在https://portal.azure.com我在 AAD 中注册了新应用程序,并根据生成的 GUID 使用以下命令生成本地应用程序:
dotnet new blazorwasm -au SingleOrg --client-id "{CLIENT ID}" --tenant-id "{TENANT ID}" -o {APP NAME}
dotnet new blazorwasm -au SingleOrg --client-id "{CLIENT ID}" --tenant-id "{TENANT ID}" -o {APP NAME}
Everything worked fine if I launched app locally.如果我在本地启动应用程序,一切正常。 If I copied published app to storage account $web and try to log in I have received:
如果我将已发布的应用程序复制到存储帐户 $web 并尝试登录,我会收到:
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: '…'.
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. 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. I don't know how to successfully configure app in AD.
我不知道如何在 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. 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.
Please give it a try then hopefully should resolve the issue.请试一试,希望能解决问题。
Note-WebsiteUrl is the Url hosted in azure注意-WebsiteUrl 是托管在 azure 中的 Url
Based on the answers and comments above, I took me 2 steps to solve this:根据上面的答案和评论,我采取了两个步骤来解决这个问题:
Azure AD must have an entry in App registration | Azure AD 必须在App 注册中有条目 | Authentication |
认证 | Single-page application |
单页申请 | Redirect URIs that reads
{WebsiteUrl}/authentication/login-callback
.重定向读取
{WebsiteUrl}/authentication/login-callback
URI。 {WebsiteUrl}
comes from the Storage account | {WebsiteUrl}
来自存储帐户 | Static website | Static 网站 | Primary endpoint .
主要终点。
Make sure that Storage account |确保存储帐户 | Static website |
Static 网站 | Index document name and Error document path both point to
index.html
.索引文档名称和错误文档路径都指向
index.html
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.