I am creating a flash game, and I would like the users to be able to log on using Facebook. So far I have used the facebook-actionscript API to successfully create a .swf file that allows users to ‘log in’ to my flash game. From here, I have access to their information such as their Facebook ID and name.
My suggested approach from here (which may be rather naive) was to use the Facebook ID as a unique identifier for a user. I would then include this id when making calls to the php back-end.
For example, if a user wanted to retrieve their list of items. I would send a ‘get items’ request to php containing their Facebook id. In my database, I would store the Facebook ID of each user and thus would be able to return the right items.
I was just wondering if there was a different/better approach to this sort of thing. I assume I would need some form of encryption if I were to go ahead with my plan. Can anyone advise on this?
Using the
User IDis ok to go ahead with but Facebook would rather you covert the User ID to something that isn’t directly identifiable to a facebook User. You would have to use a function to map the User ID to your internal User ID.Simple function:
md5( $user_id );