从 ASP.NET 应用程序连接到 Azure Active Directory
Connecting to Azure Active Directory from ASP.NET application
我正在尝试从 ASP.NET 应用程序连接到 Azure Active Directory。我正在按照微软的这篇文章编写代码:
以下是我在应用程序中输入的值:
<add key="ClientId" value="XXXXXXXXXX" />
<add key="Tenant" value="XXXXXXXXXXXXXXXXXXXX" />
<add key="Authority" value="https://login.microsoftonline.com/{0}/v2.0" />
<add key="redirectUri" value="https://localhost:5000/" />
对于我的重定向 URI,我使用 https://localhost:5000/
。这是我在 Azure 门户中的应用程序注册中配置的。当我 运行 我的应用程序时,我收到此错误:
当我将 redirectUri
更改为 https://localhost:44368/
时,我可以看到 Microsoft 登录名并且 Microsoft 也接受了 userId,但是我在输入密码后收到错误消息:
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application:
任何帮助将不胜感激。
错误说明了一切。您必须检查 App Registrations > Manage > Authentication > Redirect URL 并查看 URL https://localhost:44368/ 是否配置在那里。如果已配置,您肯定能够得到所需的响应。
我正在尝试从 ASP.NET 应用程序连接到 Azure Active Directory。我正在按照微软的这篇文章编写代码:
以下是我在应用程序中输入的值:
<add key="ClientId" value="XXXXXXXXXX" />
<add key="Tenant" value="XXXXXXXXXXXXXXXXXXXX" />
<add key="Authority" value="https://login.microsoftonline.com/{0}/v2.0" />
<add key="redirectUri" value="https://localhost:5000/" />
对于我的重定向 URI,我使用 https://localhost:5000/
。这是我在 Azure 门户中的应用程序注册中配置的。当我 运行 我的应用程序时,我收到此错误:
当我将 redirectUri
更改为 https://localhost:44368/
时,我可以看到 Microsoft 登录名并且 Microsoft 也接受了 userId,但是我在输入密码后收到错误消息:
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application:
任何帮助将不胜感激。
错误说明了一切。您必须检查 App Registrations > Manage > Authentication > Redirect URL 并查看 URL https://localhost:44368/ 是否配置在那里。如果已配置,您肯定能够得到所需的响应。