owin - ASP.NET MVC 4.5.2 connecting to IdentityServer4 -
i have website running on asp.net mvc 4.5.2. have identityserver4 server running when try , authenticate against an:
invalid_request
for asp.net core mvc documentation has:
app.usecookieauthentication(new cookieauthenticationoptions { authenticationscheme = "cookies" }); app.useopenidconnectauthentication(new openidconnectoptions { authenticationscheme = "oidc", signinscheme = "cookies", authority = "http://localhost:5000", requirehttpsmetadata = false, clientid = "mvc", savetokens = true });
i including following nuget package in project microsoft.owin.security.openidconnect. code follows:
app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = "cookies" }); app.useopenidconnectauthentication(new openidconnectauthenticationoptions { authenticationtype = "oidc", signinasauthenticationtype = "cookies", authority = "http://localhost:5000", clientid = "mvc", });
how 1 correctly connect it?
ok got working.
you need add following nuget package solution microsoft.owin.security.openidconnect .
my startup.auth.cs
contains
public void configureauth(iappbuilder app) { app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype = "cookies" }); app.useopenidconnectauthentication(new openidconnectauthenticationoptions { authority = "http://localhost:5000", //id server clientid = "demo", responsetype = "id_token code", signinasauthenticationtype = "cookies", redirecturi = "http://localhost:51048/signin-oidc", //url of website scope = "openid", }); }
my client config in identityserver is:
public static ienumerable<client> getclients() { return new list<client> { new client { clientid = "demo", allowedscopes = new list<string> { "openid"}, allowedgranttypes = granttypes.hybrid, redirecturis = new list<string>{"http://localhost:51048/signin-oidc"}, } }; }
Comments
Post a Comment