I have a Phonegap
application that is communicating with Nodejs
server.
Also for the Facebook\Twitter
login I'm using Hello.js
library (which is very easy to use by the way).
Unfortunately this library only makes client side login (authentication), so at server side I don't know if the user is valid or not (have been looged in with Facebook\Twitter).
Edit:
After the user is logged in (client side), Hello.js
provides the user credentials, with a Facebook unique user ID, but I don't know how to pass it safely to the server, or generally if its a good idea to use it as a user id in my DB.
I'm looking for a simple example that will check the validity of the login at server side too.
Thanks.
This is the main idea as I figured:
In the Phonegap application, after the user has logged in, this function will be called:
now, you can send only the
token
to the server, and the server will get the user credentials directly fromFacebook
.For example, in
Facebook
, call this usr: