6

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.

Andrew Arnott
  • 80,040
  • 26
  • 132
  • 171
Picflight
  • 3,832
  • 13
  • 61
  • 90

3 Answers3

2

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.

Andrew Arnott
  • 80,040
  • 26
  • 132
  • 171
  • I get this as well using 3.5 ctp mentioned by Andrew in MVC project using https://github.com/mhamrah/Html5OpenIdTemplate project. – TimJohnson Feb 11 '12 at 21:30
  • Really? I just downloaded it to test it and it worked fine (the CTP -- I haven't tried the template @gsogoly referenced). – Andrew Arnott Feb 11 '12 at 22:23
  • 1
    Yeah, these 400 Bad Request errors have to do with me or anyone not properly going into the facebook apps account and setting the secure url. All the samples use a specific port localhost:xxxxx. In fb, it needs to be set that way prior to testing. Took a while to figure out. Thanks though. – TimJohnson Feb 12 '12 at 23:36
  • Ah, I forgot about that. Thanks for sharing. – Andrew Arnott Feb 16 '12 at 04:14
  • **Why does your site** dont contains simple (!) files for : connect to facebook ,twitter , google etc. jsut a simple app example for each service. its not that hard. i downloaded the package with 1000 of dll's and its really hard to find a small simple code there . – Royi Namir May 29 '13 at 15:36
  • Royi, we do [have samples](http://sf.net/projects/dnoa). As for why we don't have them on the web site, it's a combination of a lack of help from outsiders (please consider contributing) and the fact that DotNetOpenAuth is a protocol library -- not a Facebook client library. As a protocol library it can be used almost anywhere for any purpose that involves the protocol, but for folks who want to call Facebook or other services to download data, a front-end library is often helpful to make your job dramatically easier, and that's beyond the scope of DotNetOpenAuth. – Andrew Arnott Jun 01 '13 at 14:33
0

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

Nandip Makwana
  • 356
  • 4
  • 16
0

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.

Community
  • 1
  • 1