【发布时间】:2017-01-31 05:57:34
【问题描述】:
我有一个在 ASP.NET MVC 4.5.2 上运行的网站。我有一个 IdentityServer4 服务器正在运行,但是当我尝试对其进行身份验证时,我得到:
invalid_request
对于 ASP.NET Core MVC,documentation 具有:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationScheme = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
AuthenticationScheme = "oidc",
SignInScheme = "Cookies",
Authority = "http://localhost:5000",
RequireHttpsMetadata = false,
ClientId = "mvc",
SaveTokens = true
});
我在我的项目 Microsoft.Owin.Security.OpenIdConnect 中包含以下 NuGet 包。我的代码如下:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "Cookies"
});
app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
AuthenticationType = "oidc",
SignInAsAuthenticationType = "Cookies",
Authority = "http://localhost:5000",
ClientId = "mvc",
});
如何正确连接到它?
【问题讨论】:
-
IdentityServer4 应用程序的日志说明了什么?添加一些日志记录。
-
你好,我正在尝试同样的事情......你有没有得到解决?它甚至有用吗?
-
@JalalEl-Shaer 添加了答案。希望对您有所帮助。
标签: asp.net-mvc-5 owin openid-connect identityserver4