Sign in to follow this  

[web] Facebook game login questions

Recommended Posts

Mehar    100

I'm in the process of converting a PHP browser game to run in a Facebook application. The only issue I'm running into is regarding user access/logging in. The way it works with most Facebook games is your account is tied to your game so when you load an application you're automatically logged into the game assuming you're logged into Facebook. I'm not too sure how to proceed here, how it works with the regular game is a user logs in via a form and after successful authentication a session is created.

I'm assuming a similar system can be implemented here as well although I don't know how Facebook communicates with the application and I can't find any PHP related tutorial that is up to date. To sum it up, I'm stumped.

Does anyone have any ideas?

Share this post

Link to post
Share on other sites
cagecrawler    240
Assuming you're wanting to keep the same accounts, you need to link a Facebook account with a game account. When the page is loaded through Facebook, you use their API to confirm the login and then check your application to see if the person has a game account. If they don't, prompt them to create one (or link an existing account to Facebook) else populate the session with the relevant data as you would normally. The only extra data you will (probably, I've not got round to implementing this on my game yet) need to store is the Facebook account ID to link with the game account. Using this, you can actually still allow a user to log on outside of Facebook using the existing method, although whether to allow this depends on your level of interaction with Facebook.

The [url=""]Facebook developer documentation[/url] gives a good explanation of how you can authenticate users as well as examples of flows and code.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this