I notice in the asp.net 4.5 template, all the authorization samples besides google pass in secret and clientid. How can I pass in my google secret and clientid? Brock has a good discussion here that I'm following:

http://info.develop.com/blogs/bid/232864/ASP-NET-Using-OAuthWebSecurity-without-SimpleMembership#.UNuBh2_Adv9

The sample code is as follows that comes with the template.

internal static class AuthConfig
{
    public static void RegisterOpenAuth()
    {
        // See http://go.microsoft.com/fwlink/?LinkId=252803 for details on setting up this ASP.NET
        // application to support logging in via external services.

        //OpenAuth.AuthenticationClients.AddTwitter(
        //    consumerKey: "your Twitter consumer key",
        //    consumerSecret: "your Twitter consumer secret");

        //OpenAuth.AuthenticationClients.AddFacebook(
        //    appId: "your Facebook app id",
        //    appSecret: "your Facebook app secret");

        //OpenAuth.AuthenticationClients.AddMicrosoft(
        //    clientId: "your Microsoft account client id",
        //    clientSecret: "your Microsoft account client secret");

       // OpenAuth.AuthenticationClients.AddGoogle();
    }
}
有帮助吗?

解决方案

I had a look at the source code of the OAuthWebSecurity class.

The reason Google's authentication client doesn't need an AppId/AppSecret is because its implementation is using OpenId and NOT OAuth.

If you want to use OAuth with Google you'll have to write your own client (at least for right now).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top