xamarin / Xamarin.Social

Xamarin.Social
Apache License 2.0
123 stars 74 forks source link

Facebook API 2.0 calls fail to get Username #29

Open flish opened 10 years ago

flish commented 10 years ago

By default all facebook apps are using version 2.0 of the API (can this be changed at their end?) and looks like there's a breaking change that affects GetUsernameAsync() in FacebookService.cs

Currently you check for presence of "username" in the json response and through an exception if not found (see https://forums.xamarin.com/discussion/comment/53902/) looks like in version 2.0 of the API this value is no longer returned (See https://developers.facebook.com/docs/graph-api/reference/v2.0/user) - simply changing to check for "name" gets us through that section, but am seeing 403+ errors when actually share, not sure if related, "name" may be the wrong field to use, or possibly other breaking changes in the API.

Quick fix may be to change all API endpoints to the specific 1.0 Urls

flish commented 10 years ago

Looks like using version 1.0 is not an option for any newly created facebook apps, from facebook;

"An app can make calls to versions of the API that were current when the app was created. This means if your app was created when v1.0 was available, then it can make calls to v1.0 until v1.0 expires. If your app was created after v2.0 was released, it won't be able to make calls to v1.0. In addition, apps that were created on older API versions but haven't been used won't be able to use older API versions. This will hold true for all future API version releases."

So it looks like we need to move to version 2 API Calls

flish commented 10 years ago

I believe this is resolved in pull request #30 if you choose to merge, other 2.0 rules appear unbroken