11

I'm attempting to use DotNetOpenAuth for some web single sign on functionality.

I got the samples working for Google and Yahoo but am struggling with Facebook.

I am using the CTP (4.0.0.11165) and have followed the example in this SO question.

However, I get a runtime error on the line:

IAuthorizationState authorization = client.ProcessUserAuthorization();

The error is:

Failed to obtain access token. Authorization Server reports reason: (unknown)

Any ideas?

Community
  • 1
  • 1
DaveM
  • 113
  • 4

3 Answers3

12

The build you're using is incompatible with Facebook because Facebook is using an older spec of OAuth 2.0. You have to use an earlier CTP (one with a v3.5 version) to work with Facebook. Sorry. It stinks to be using OAuth 2.0 when everyone is on a different draft of the unfinalized spec.

Andrew Arnott
  • 80,040
  • 26
  • 132
  • 171
  • I downloaded the ctp and can't find samples for fb in there? i have the master branch and it does. but you're saying they won't work. Should I expect to see samples in the ctp for fb? –  Sep 09 '11 at 14:21
  • Also, if i use this ctp version, will i find myself in a strange place further down the line? are fb planning on coming in line with everyone else at some point? –  Sep 09 '11 at 14:24
  • I can't speak for Facebook, but I can only imagine that they'll adopt the final version of OAuth 2.0 when it is (finally) finalized. The earlier version of the DNOA CTP that does interop with FB does include a facebook sample, yes. – Andrew Arnott Sep 11 '11 at 05:07
  • the one on the download doesn't: http://sourceforge.net/projects/dnoa/files/releases/v3.4/v3.4.7/DotNetOpenAuth-3.4.7.11121.zip/download –  Sep 13 '11 at 08:44
  • Andrew, is this still actual? Getting similar exception while using DNOA version 4.0.0 – buru Mar 12 '13 at 17:59
  • 1
    DNOA 4.0.0 is pretty old too. I don't remember whether that should work with Facebook. But the latest version should work (4.2.2, IIRC) – Andrew Arnott Mar 13 '13 at 02:50
0

I think you need to add

client.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter("App_Secret");
Muhammad Soliman
  • 529
  • 5
  • 17
0

I was facing the similar issue while using https://github.com/baio/open-mvc .

I resolved it by building again the DotNetOpenAuth.ApplicationBlock project of Latest CTP(4.0.0.11165) with DotNetOpenAuth version 3.5.0.10357 downloaded from open-mvc repo.

And it worked fine for facebook.

I am still testing it for other IDP's

Mukesh Agarwal
  • 392
  • 4
  • 13