简体   繁体   中英

DotNetOpenAuth and Facebook

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?

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.

I think you need to add

client.ClientCredentialApplicator = ClientCredentialApplicator.PostParameter("App_Secret");

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM