openid connect AuthorizationCodeReceived not firing

Viewed 184

I am trying to use openId connect in an existing .net 4.6.2 application.

I created an Owin start.cs file. the notification does not fire at all. I am not redirected anywhere.

I am trying to use authentication_code flow. This is my code:

public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie
            });
            app.UseOpenIdConnectAuthentication(
                new OpenIdConnectAuthenticationOptions()
                {
                    ClientId = "[client Id]",
                    Authority = "[url]",
                    RedirectUri = "[redirect url]",
                    ResponseType = "code id_token",
                    Scope = "openid offline_access",
                    SignInAsAuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                    Notifications = new OpenIdConnectAuthenticationNotifications()
                    {
                        RedirectToIdentityProvider = (context) =>
                        {
                            Debug.WriteLine("*** RedirectToIdentityProvider");
                            return Task.FromResult(0);
                        },
                        MessageReceived = (context) =>
                        {
                            Debug.WriteLine("*** MessageReceived");
                            return Task.FromResult(0);
                        },
                        SecurityTokenReceived = (context) =>
                        {
                            Debug.WriteLine("*** SecurityTokenReceived");
                            return Task.FromResult(0);
                        },
                        SecurityTokenValidated = (context) =>
                        {
                            Debug.WriteLine("*** SecurityTokenValidated");
                            return Task.FromResult(0);
                        },
                        AuthorizationCodeReceived = (context) =>
                        {
                            Debug.WriteLine("*** AuthorizationCodeReceived");
                            return Task.FromResult(0);
                        },
                        AuthenticationFailed = (context) =>
                        {
                            Debug.WriteLine("*** AuthenticationFailed");
                            return Task.FromResult(0);
                        }
                    }
                });
        }
    }

what could possible be wrong?

0 Answers
Related