我创建了一个使用 Azure Active Directory 身份验证的 Web 应用程序。
在本地主机上一切正常,但是当我将应用程序发布到 Azure 时出现以下错误:
AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application: '656cc46c-f858-4a45-bf83-698791e052f1'.
我尝试过的:
在 Azure 中,我将相关应用程序的回复 URL 配置为:
http://gp-rh.azurewebsites.net/signin-oidc
这是我的 appsetting.json:
{
"AzureAd": {
"Instance": "https://login.microsoftonline.com/",
"Domain": "legroupeti.com",
"TenantId": "7c6ff5e2-0660-4b65-9b64-7a78df412819",
"ClientId": "656cc46c-f858-4a45-bf83-698791e052f1",
"CallbackPath": "/signin-oidc"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}
在我的应用程序中,执行登录的 Controller 设置如下:
[HttpGet]
public IActionResult SignIn() {
var redirectUrl = Url.Action("Index", "Dashboard",
new { date = DateTime.Now, anchor = "period" });
return Challenge(
new AuthenticationProperties { RedirectUri = redirectUrl },
OpenIdConnectDefaults.AuthenticationScheme);
}
我的应用程序的默认页面是 /
,它重定向到 /Dashboard
。
不知道哪里出错了,还是不行。
最佳答案
redirect_uri
必须完全匹配您注册的 URI 之一,包括方案(http://
、https://
)。
一般来说,您应该仅将不安全的方案 (http
) 用于开发目的。对于测试/阶段/生产,您应该始终使用安全连接 (https
)。在这种情况下,绝对没有理由不使用 https://gp-rh.azurewebsites.net/signin-oidc
,因为 azurewebsites.net
默认支持 HTTPS。
关于c# - Microsoft ADD - 应用程序注册 - 请求中指定的回复网址与配置的回复网址不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50957573/