Asp.net 和 Facebook 身份验证
我想执行以下操作:
- 允许用户使用他们的 facebook 凭据在我的 asp.net 站点中注册。
- 检索 Facebook 客户信息。例如(姓名、电子邮件地址等)。这样我就可以将此信息导入到我的应用程序中。
- 允许用户使用 Facebook 凭据登录我的网站。
我一直在搜索并遇到了以下选项:
- Facebook.net SDK
- dotnetoauth
- Facebook Connect
- Graph API
我很困惑,不知道哪种方法是解决此问题的最佳方法。
I'd like to do the following:
- Allow users to register in my asp.net site using their facebook credentials.
- Retrieve facebook client information. Like (Name, surname, email address etc). So I can import this information into my application.
- Allow users to log into my site using facebook credentials.
I've been searching and have come across these options:
- Facebook.net SDK
- dotnetoauth
- Facebook Connect
- Graph API
I'm confused as to which would be the best way to go about this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这个资源提供了一个关于如何与 Facebook 的用户基础设施集成的很好的教程:
http://devtaulous.com/articles/bkonrad/how-to-retrieve-user-data-from-facebook-connect-in-aspnet/
有还有这个代码示例/框架,它会带您完成大部分过程:
http://fbconnectauth.codeplex.com/
这个演练是最新的:
http://area72.ro/general-it/how-to-login-via-facebook-in-asp-net.html
I think that this resource offers a good tutorial on how to integrate with Facebook's user infrastructure:
http://devtacular.com/articles/bkonrad/how-to-retrieve-user-data-from-facebook-connect-in-aspnet/
There is also this code example / framework which takes you though much of the process:
http://fbconnectauth.codeplex.com/
And this walkthrough which is a little more up-to-date:
http://area72.ro/general-it/how-to-login-via-facebook-in-asp-net.html
实现解决方案的最简单方法是使用 javascript SDK。
您添加一个 Facebook 登录按钮,用户单击该按钮并授权您的网站允许您访问他的信息。这基本上跳过了 Facebook 用户注册的需要,因为注册是实际的登录过程。
当用户授权您的网站(因此登录并注册)时,您可以访问他的信息,您可以使用他的 Facebook ID 作为密钥将其存储在您的用户数据库中。您可以通过向图 API 发送 http 请求来访问用户信息 https://graph.facebook.com/facebook_id 将返回一个包含用户信息的 json 对象。
除了 facebook 登录之外,您还需要一个标准的登录,为没有 facebook 的用户提供注册表。
http://developers.facebook.com/docs/guides/web/
The easiest way to implement your solution would be to use the javascript SDK for this.
You add a Facebook Login button which the user clicks on and authorizes your website giving you access to his information. This basically skips the need for registration for facebook users since the registration is the actual login process.
When the user has authorized your website (thus logged in and registered) you have access to his information which you can use to store in your users database using his faceboook id as a key. You can access the user's information sending an http request to the graph api https://graph.facebook.com/facebook_id which will return a json object with the users information.
Other then the facebook login you will want a standard login, registration form for users without facebook.
http://developers.facebook.com/docs/guides/web/