This project has moved and is read-only. For the latest updates, please go here.


Sep 26, 2014 at 6:45 PM
Edited Sep 26, 2014 at 6:47 PM
I'm using ver.3.0 and the updated to Google middleware with code below
                string clientId = ConfigurationManager.AppSettings.Get("GoogleClientID");
                string clientSecret = ConfigurationManager.AppSettings.Get("GoogleClientSecret");

                var googleOptions = new Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationOptions()
                    ClientId = clientId,
                    ClientSecret = clientSecret,
                    SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie,
                    Provider = new Microsoft.Owin.Security.Google.GoogleOAuth2AuthenticationProvider()
                        OnAuthenticated = async context =>
                            context.Identity.AddClaim(new System.Security.Claims.Claim("urn:google:access_token", context.AccessToken, XmlSchemaString, "Google"));


However, it does NOT add Google provider. Then I added line below and it has fixed the issue.

googleOptions.AuthenticationType = "Google+";

(the last symbol is a plus)

I found out that GoogleOAuth2AuthenticationOptions constructor passed Constants.DefaultAuthenticationType = "Google" to the base class, i.e. the same as in deprecated GoogleAuthenticationOptions . At the same time I saw numerous samples to use Google provider with very simple code:
         clientId: "",
         clientSecret: "00000000000");
Could you explain what is the proper way to use the latest Google provider?
Sep 26, 2014 at 8:01 PM
Your code looks fine. They value of the AuthenticationType shouldn't matter so long as it's unique in your app. E.g. if you set up two google auth middleware then you'll need to assign them different auth types. Are you still using the old obsolete provider?

Check here to see what that last extension does:
Sep 26, 2014 at 8:47 PM
Sorry, everything is ok. I didn't realize that AuthenticationType is used in our code to generate the social signin buttons - that's why removing "Google+" was implicitely defaulted ApplicationType to "Google" and make the corresponding Sign In button hidden.