We’re creating a game that will run on iOS, Android and in the web browser. All data must be interchangeable, so that if a user gets an highscore on their iPhone it should be visible in the webclient too.
This means i’ve made a webservice which stores highscores and facebook id’s, and currently when we want to get the scores of the user’s friends it works as follows:
- Device
- Facebook Graph (/me/friends)
- Device
- Webservice (/Highscores/Get/?friends=…)
Each platform implements their own connection to facebook, so the webclient uses the Javascript SDK and Android uses the native libraries. However this has proven not to be ideal, as there are many requests being made and issues like paging and sending all data back and forth is a real hassle. Getting the webservice to show all of the user’s thousands of friends scores would mean sending all the id’s to the webservice.
Ideally i think i’d want the webservice to connect to facebook directly; so my webservice can make calls to the graph api. Can we just login using the native available libraries and send the access token to the server? What is the recommended way to implement such a service?
Kind regards,
Tijmen
Yes, getting the token on the device and sending it to the server works as expected. I implemented this exact mechanism in my last app.
The server can directly use the received token with the FB Graph API requests.