I am developing an Phonegap based application, that uses Facebook OAuth for SSO login. How to validate the FB.login javascript response on server side? After successful redirection from Facebook mobile back to my app I get the userId and accessToken. It is enough to check the accesToken to gain access for the User on the server?
https://graph.facebook.com/me?fields=id&access_token=...
My Problem is JS & PHP mix on mobile and web:
The user uses FB.login on mobile (Javascript) and returns sucessfully (client), because the user has already connected via web. Now I can check the FB id in my database to load the user credentials via AJAX request. How to make the AJAX request secure. The prototype will login everyone that passes a valid FB, which exits in my DB too. So the system is open to get a session without revalidating on FB (server). My Idea was to check if the accessToken is valid, but not sure if this is enough… I think is is not… maybe check IP too?
Using the SignedRequest instead of accessToken seams to be the correct choice for my needs, e.g. PHP solution, using app secret.
see: https://developers.facebook.com/docs/howtos/login/signed-request/
PROBLEM
I did not receive the signed_request, these are undefined:
and the this one contains only “…”
Anyone an idea?
EDIT
Ok .sig seam to be provided only by my plugin, hard coded: so the fix should bein there https://github.com/davejohnson/phonegap-plugin-facebook-connect
But reported:
https://github.com/davejohnson/phonegap-plugin-facebook-connect/issues/245