使用asp.net 4.5的OAuth与客户端ID和秘密注册谷歌 [英] Using asp.net 4.5 OAuth to register google with clientid and secret
问题描述
我注意到在asp.net 4.5模板,除了谷歌的所有授权样品合格秘密和客户端ID。我怎么能传递我的谷歌秘密的clientid?布洛克具有良好的讨论,在这里,我在下面:
<一个href=\"http://info.develop.com/blogs/bid/232864/ASP-NET-Using-OAuthWebSecurity-without-SimpleMembership#.UNuBh2_Adv9\">http://info.develop.com/blogs/bid/232864/ASP-NET-Using-OAuthWebSecurity-without-SimpleMembership#.UNuBh2_Adv9
样品code是如下自带的模板。
内部静态类AuthConfig
{
公共静态无效RegisterOpenAuth()
{
//参见http://go.microsoft.com/fwlink/?LinkId=252803上设置此ASP.NET细节
//应用程序支持通过外部服务登录。 //OpenAuth.AuthenticationClients.AddTwitter(
// consumerKey:你的Twitter使用者密钥
// consumerSecret:你的Twitter用户的秘密); //OpenAuth.AuthenticationClients.AddFacebook(
// APPID:你的Facebook应用程序ID
// appSecret:你的Facebook应用程序的秘密); //OpenAuth.AuthenticationClients.AddMicrosoft(
//的clientId:您的Microsoft帐户的客户ID
// clientSecret:您的Microsoft帐户的客户端秘密); // OpenAuth.AuthenticationClients.AddGoogle();
}
}
我有一个看的的<源$ C $ C href=\"http://msdn.microsoft.com/en-us/library/microsoft.web.webpages.oauth.oauthwebsecurity%28v=vs.111%29.aspx\"相对=nofollow> OAuthWebSecurity
类。
原因谷歌的认证客户端不需要一个AppID / AppSecret是因为它的实现是使用 的OpenID 和不会的OAuth 。
如果你想使用OAuth与谷歌,你必须编写自己的客户(至少现在)。
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:
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).
这篇关于使用asp.net 4.5的OAuth与客户端ID和秘密注册谷歌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!