加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

使用asp.net 4.5 OAuth注册google与clientid和secret

发布时间:2020-12-16 03:28:11 所属栏目:asp.Net 来源:网络整理
导读:我注意到在asp.net 4.5模板中,谷歌以外的所有授权样本都是秘密通过并且clientid.我如何传递我的谷歌秘密和clientid? Brock在这里有一个很好的讨论我正在关注: http://info.develop.com/blogs/bid/232864/ASP-NET-Using-OAuthWebSecurity-without-SimpleMem
我注意到在asp.net 4.5模板中,谷歌以外的所有授权样本都是秘密通过并且clientid.我如何传递我的谷歌秘密和clientid? Brock在这里有一个很好的讨论我正在关注:

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

模板附带的示例代码如下所示.

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

解决方法

我看了 OAuthWebSecurity班的 source code.

Google的身份验证客户端不需要AppId / AppSecret的原因是因为它的实现使用的是OpenId而不是OAuth.

如果您想在Google上使用OAuth,则必须编写自己的客户端(至少目前为止).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读