【发布时间】:2017-09-29 06:06:02
【问题描述】:
我花了很多时间尝试进行此设置,但似乎从未取得成功。我还没有找到任何似乎将最新配置放在一起并工作的示例。
app.UseCookieAuthentication(new CookieAuthenticationOptions()
{
AuthenticationScheme = "Cookies",
AutomaticAuthenticate = true
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions()
{
AuthenticationScheme = "Microsoft Signin",
SignInScheme = "Cookies",
Authority = "https://login.microsoftonline.com/common/v2.0",
ResponseType = "id_token",
ClientId = "XXXXXXXXXXXXXXXXX",
ClientSecret = "XXXXXXXXXXXXX",
SaveTokens = true
});
我设置了一个 Microsoft 应用程序来创建应用程序 ID 和密码。然后我将 RedirectUrls 设置为 http://localhost:12343/signin-microsoft,这是我的应用程序的当前位置。当我尝试进行身份验证时,我收到此错误。
We're unable to complete your request
Microsoft account is experiencing technical problems. Please try again later.
在 URL 地址中嵌入了另一个错误。
The provided value for the input parameter 'redirect_uri' is not valid. The
expected value is 'https://login.live.com/oauth20_desktop.srf' or a URL which
matches the redirect URI registered for this client application.
我已经尝试了所有我能想到的变体,但似乎没有任何效果。我还使用在线托管的代码尝试了这些事情,以防负责身份验证的服务器找不到本地主机但仍然没有运气。
我现在已将 microsoft 应用程序 RedirectUrls 的值更改为
http://localhost:10223/signin-oidc
当我进行身份验证时,它现在将我发送回此位置,但我收到 500 错误。
【问题讨论】:
-
你看了吗...docs.microsoft.com/en-us/aspnet/core/security/authentication/…他们似乎有一步一步的教程...
-
这与 OpenIdConnect 有什么不同吗?似乎只是身份验证。
-
当您有用户使用中间件登录时,您应该能够遍历并查看 MSFT 已通过的声明,前提是用户授予了权限。
-
@Muqeet Khan。我将如何进行声明的迭代?
-
您必须为您的网站启用 ssl
标签: authentication configuration asp.net-core azure-active-directory openid-connect