Facebook App-Scoped User IDs in API v2

My company’s website recently went through the Facebook API v1 to v2 upgrade. Besides having to upgrade the OS on all our web servers so we could upgrade PHP, and having to rewrite our implementation code, the only real undocumented issue was dealing app ID format changes.

Facebook apps now use a new app-scoped ID that is unique to your app instead of using the global Facebook User ID — makes sense because it’s more secure for the user.

But What About Previous Connections with v1 IDs?

No matter what version they originally used to sign up for your app, the ID will remain the same for people who have already logged into your app. This change is backwards-compatible for anyone who has logged into your app at any point in the past.

-Excerpt from the Facebook Platform Upgrade Guide.

Great! However, there’s one caveat: Even though the ID number remains the same, the Identifier field format has evolved and is now different.

The API v2 formats app-scope identifiers are formatted as

The API v1 IDs are now formatted as

But as some point in time, Facebook identifiers were formatted as

If you map your users via the Facebook Identifier (like we do), this inconsistency can mess up your mappings.

Once we ran a simple update query to change all http://www.facebook.com/profile.php?id=xxxxxxxxxxx to the new https://www.facebook.com/xxxxxxxxxxx, our mappings were restored, and the Facebook API v2 logins work as expected.

UPDATE MAY 7, 2015
We continued to have issues with the Facebook API returning inconsistent Identifier formats, so we switched our mappings to use the Scope ID instead of the Facebook Identifier.

Related Posts