This project has moved. For the latest updates, please go here.

".AspNet.Correlation.Google cookie not found."

Aug 7, 2015 at 8:36 PM
Hello, I'm using .net. 4.5.2 and latest version on Identity in my application.
There are cases I get strange error from external login ".AspNet.Correlation.Google cookie not found."

In the logs I see the the I see the url "/signin-google?state=STATE FROM GOOGLE" but "AuthenticationManager.GetExternalLoginInfoAsync" returns NULL and my logs showing the error I mentioned.

This is my configurations:
 var cookieOptions = new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath = new PathString("/Account/Login"),
                CookieName = ".myApp",
CookieDomain = ".myApp.com"
                CookieHttpOnly = true,
                SlidingExpiration = false,
                Provider = new CookieAuthenticationProvider
                {
                    OnResponseSignOut = (context) =>
                    {
                        //remove user cache
                    },
                    OnResponseSignIn = context =>
                    {
                        //add token to claims
                        
                    },

                    OnException = (context) =>
                    {
                        //prevent exception display
                    },
                    OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<UserManager, User, int>(
                        validateInterval: TimeSpan.FromMinutes(IdentityExpiresIn),
                        regenerateIdentityCallback: (manager, user) =>
                        {
                            var identity = manager.CreateIdentityAsync(user,
                                DefaultAuthenticationTypes.ApplicationCookie);
                            return identity;
                        },
                        getUserIdCallback: (id) => (id.GetUserId<int>()))
                }
            };

  app.UseCookieAuthentication(cookieOptions);
  app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);

  var googleOAuth2AuthenticationOptions = new GoogleOAuth2AuthenticationOptions()
            {
                ClientId = Wishiz.Configuration.AppSettings.Get<string>("GoogleAppID"),
                ClientSecret = Wishiz.Configuration.AppSettings.Get<string>("GoogleAppSecret"),
                SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
                
            };

            googleOAuth2AuthenticationOptions.Scope.Add("email,profile");
            app.UseGoogleAuthentication(googleOAuth2AuthenticationOptions);
The issue happens usually when using mobile devices and Chrome (cookies are supported)
Coordinator
Aug 7, 2015 at 8:44 PM
Shouldn't there also be a 'code' parameter in that url? This may be related to https://katanaproject.codeplex.com/workitem/419
Aug 8, 2015 at 1:32 PM
There was code parameter. I removed it for this presentstion
Aug 25, 2015 at 1:37 PM
Any insights?
Coordinator
Aug 25, 2015 at 1:40 PM
Aug 25, 2015 at 1:43 PM
I already implemented this solution and still have this issue. I must say it's not only Google, I have the same issue with Facebook correlation cookie