Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FacebookOAuthClient.GetAccessTokenFromAuthCode returns null #18

Closed
azzimuth opened this issue Mar 28, 2017 · 8 comments
Closed

FacebookOAuthClient.GetAccessTokenFromAuthCode returns null #18

azzimuth opened this issue Mar 28, 2017 · 8 comments
Assignees

Comments

@azzimuth
Copy link

My Facebook integration stopped working and once I debug I see that the FacebookOAuthClient.GetAccessTokenFromAuthCode stopped returning valid access token and returns instead null. Are there any breaking changes in Facebook's API which could cause this? As I said, this was working flawlessly until now.

@azzimuth
Copy link
Author

I tested by running the Fiddler and capturing HTTP traffic. I see that the request to graph.facebook.com is successful and an object with valid (as far as I can interpret it) access token is returned by Facebook.

I guess that something is happening in method HttpUtility.ParseQueryString which causes that the ["access_token"] field in the NameValueCollection is null.

@abjerner
Copy link
Owner

@azzimuth Thanks for reporting :D

I'm not aware that Facebook has changed anything regarding authentication, but I will investigate further.

Btw - are you using Skybrud.Social or Skybrud.Social.Facebook?

@abjerner abjerner self-assigned this Mar 28, 2017
@azzimuth
Copy link
Author

azzimuth commented Mar 28, 2017

@abjerner I've found out that I'm using Skybrud.Social and the signature of FacebookOAuthClient.GetAccessTokenFromAuthCode differs from the one in this repository. I will try to replace Skybrud.Social with Skybrud.Social.Facebook.

@azzimuth
Copy link
Author

Tried to use the beta NuGet packages but I'm getting some errors saying that Skybrud.Social.Instagram cannot initializea number of classes in Skybrud.Social.Core.

So I'm still stuck with this problem.

@abjerner
Copy link
Owner

@azzimuth Skybrud.Social is still the stable version, so if you're also using some of the other services supported by this package, it is recommended to keep using it. In the future, each service will be released as an individual package - hence Skybrud.Social.Facebook for Facebook - but this is still work in progress.

Anyways, yesterday Facebook dropped support for v2.2 of the Graph API (newest version is v2.8). I was aware of this, but hadn't noticed that it also affected authentication. From v2.3 and newer versions, Facebook will now return JSON instead of key/value pairs for the various responses received from Facebook during authentication.

I have updated Skybrud.Social to support the JSON in newer versions - you can find the new release here:

https://github.com/abjerner/Skybrud.Social/releases/tag/v0.9.5

The issue still exists in Skybrud.Social.Facebook, but I will look into fixing that as well.

@azzimuth
Copy link
Author

@abjerner Great! Thanks a lot! Saw that even the NuGet package was updated :)

@mrflo
Copy link

mrflo commented Apr 10, 2017

@azzimuth I had exactly the same and found it was JSON using Fiddler as well. Thanks @abjerner for updating !
It's always annoying to have users that can't suddenly log in...
Is there a way to make an automated test with notification for Facebook login on a website to avoid future issue ?

@abjerner
Copy link
Owner

@mrflo Generally Facebook will notify you if your app is configured to use a version of their API that is being deprecated.

The problem with Skybrud.Social was that authentication would always use the oldest version available of the Graph API since Skybrud.Social didn't explicitly specify a version to be used. Even for new Facebook apps only allowed to use v2.8, the authentication page from v2.2 would still be used prior to the 27th of March.

I'm not sure how to make automated tests for authentication. However with the release (v9.5.0), Skybrud.Social will explicitly use v2.3 of the Graph API. This is only the default version - Skybrud.Social has a setting for specifying the version to be used.

In the future, the idea is that Skybrud.Social.Facebook will always use the newest available version of the Graph API, which also means that I - in theory - should catch issues like this before they become a problem for users of my package (given that they update the package now and then).

@abjerner abjerner closed this as completed Jul 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants