How to log in with Facebook using DotNetOpenAuth

荒凉一梦 提交于 2019-12-05 00:39:36

问题


I have searched, read the FB developer docs.

MVC 4, I incorporated OpenId.
Now I want to include FB login as well, just as Stackoverflow and some other site have implemented it.

Do I create my own JS file with sample code from FB developer?
OR
Use a third party tools, which I am not aware of what to use. I did look at OAuthClient (DotNetOpenAuth-4.0.0.11165), it could not run, there was a server error and could not debug as the source file was missing.


回答1:


Facebook implements an older OAuth 2 spec than the latest DotNetOpenAuth beta does. To interop with Facebook, you should use the CTP of v3.5 of DotNetOpenAuth to avoid the 400 Bad Request error.




回答2:


In the latest release of DotNetOpenAuth (4.0.0.12084) Login with Facebook works fine.

In order to make Sample solution build: install Code Contracts: http://msdn.microsoft.com/en-us/devlabs/dd491992.aspx

And to make example with Facebook login working you need to

  1. Create your own App on Facebook
  2. Specify you local website Url in the App settings (in "Select how your app integrates with Facebook" section)
  3. Update Web.config (OAuthClient project) file with your App ID and App Secret.
  4. in DotNetOpenAuth.ApplicationBlock.Facebook.FacebookGraph change type of Id property from int to long
  5. Run OAuthClient project. It should work.

More details here: Facebook/ Twitter with dotnetopenauth?

Also read Release notes regarding OAuth 2.0 (http://www.dotnetopenauth.net/oauth/dotnetopenauth-4-0-released/) As far as I understand it's not yet stable, but I'm sill studying this. So far it works fine for me.




回答3:


This post explain how to enable OAuth & OpenID authentication and integration in asp.net MVC 4 application.

http://www.dotnetexpertguide.com/2012/08/facebook-twitter-oauth-openid-login-with-aspnet-mvc-4-application.html



来源:https://stackoverflow.com/questions/9164740/how-to-log-in-with-facebook-using-dotnetopenauth

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