DotNetOpenAuth and Facebook

2019-04-20 09:56发布

问题:

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?

回答1:

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.



回答2:

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



回答3:

I think you need to add

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