Using asp.net 4.5 OAuth to register google with clientid and secret

旧时模样 提交于 2019-12-05 01:35:08

问题


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();
    }
}

回答1:


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).



来源:https://stackoverflow.com/questions/14047382/using-asp-net-4-5-oauth-to-register-google-with-clientid-and-secret

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!