Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different FB ID on Web App and Mobile App for Facebook Login API

Is the fbid returned by Facebook Login API changes if 2 different Secret and App ID is used?

On my website the user gets to register himself using facebook details. I'm storing the fbid in the users table.

There's an iOS app for the site on which I allow the users to login using their facebook credentials. So I've coded an API which takes the fbid sent by the mobile app and checks if the fbid exits in the users table. If it's present then a token is sent to the mobile app with login successful message.

I've noticed that I get different fbid on web app and on mobile app for same facebook user.

I've created an APP on facebook using my facebook account and my friend who is developing the iOS app has created an APP on facebook from his own facebook account.

Example: I get fbid: 134200716970889 on web app and 140274429696834 on iOS app for a same facebook account.

Why do we get different fbid?

I'm using cakePHP for web app.

like image 230
Xylon Avatar asked Mar 13 '23 00:03

Xylon


1 Answers

It is called "App Scoped ID", you get a seperate ID per App since v2.0 of the Graph API: https://developers.facebook.com/docs/apps/changelog#v2_0

You can use the Business Mapping API to map User IDs between different Apps: https://developers.facebook.com/docs/apps/for-business

like image 103
andyrandy Avatar answered May 16 '23 06:05

andyrandy