So here it is…
a 15 minute long tutorial of me babbling on about how to get access to Facebook, save a users friends list to your MySQL database and send that out to GameSalad.
1 • Put a new database and table on your already running local server
2 • Put the needed PHP files in the correct local server folder
3 • Create App on Facebook developer site
– Get App Id and Secret Code
– Add the required URL information in 4 places.
4 • Update each script with the App Id, Secret code, URLs and database/table names. Plus a rough run through of what’s going on in each of the three scripts.
5 • Trickest part I try to explain is toward the bottom of the callback.PHP file where you need to ensure the file you output from your Database is formatted exactly the same as the way GameSalad sends out its JSON files.
• Put correct URLs in the GameSalad Demo,
• Then running the demo… Success!!
PLUS HERE’S SOME USEFUL INFO ON CUSTOMISING THIS FURTHER:
PERMISSIONS AND DATA:
• Facebook Permissions for apps:
• What data is accessible from a friends list:
Facebook login using Service Side Code and the URL behaviors
Facebooks official info on building a manual login
Tutorial for the PHP script that mine was originally based on.
Here is the link to download the files used in this tutorial:
Plus here is an updated loginwithfb.php script.
This has an automatic redirect to Facebook where a user will be asked to login if not already logged in and then approve any permission requests. So the user does not have to press a login with Facebook button on the first loginwithfacebook.php webpage. This makes it a little smarter as they would already have pressed login once in the game before opening up the embedded browser.
The script has a clever work around to allow you to do a redirect to the Facebook Oauth login page with the need for them to press a button. (A redirect it seems is normally done in the header text of the script, but we need to build up the url in the PHP code first. So the redirect is triggered later.
It just takes out one small step for the user…
Download the updated file here:
I hope you like the video and it all makes sense.