facebookfacebook-loginfacebook-sdk-4.0facebook-account-kit

Facebook Account Kit and Facebook Login


For my android app I am using both Facebook login and Account Kit. Is it safe and sound to take the id issued by either Facebook login or Account kit as the user_id for that particular user on the app's backend Server database.

If yes, will the uniqueness be maintained between users irrespective the fact how they login to system.


Solution

  • No you should not.

    The Facebook ID and Account Kit ID are 2 different things. The Facebook ID of a user is kind of constant where as the Account Kit ID is generated for you app only with respect to that particular user. You should not combine these IDs to store the user_id. The main reason being that this way you are restricting each user to sign in with only one method always. What if a user would want to log in using his Facebook sometimes and other times using the Account Kit.

    To explain the problem you could face - Imagine a user first logs into your app using Facebook Login and so you set the user's user_id to his/her Facebook ID.

    This same user then logs out and logs in again using the Account Kit this time. So this time you would be getting his/her Account Kit ID which will be different to his/her Facebook ID. Now you won't be able to recognize this user and would have to treat him/her as a new user resulting in 2 accounts for the same user.