I'm developing iPhone application, that is based on communication with server, and I want to use Facebook authentication mechanisms.
Basically, I think it should work like this:
- In my iPhone app, user logs in to Facebook, using his email and password.
- User allows access to his data for related Facebook application.
- My iPhone app receives access token, after successful log in.
- In further communication with my server, my iPhone application should use the received Facebook access token (for example: in queries).
- When my server receives some query from iPhone app, with access token, it should ask Facebook that this token is valid (and for who), and if yes, server should assume that user is authenticated with Facebook.
My question is: how the server should ask Facebook if given access token is valid? I think I should somehow check if the token is valid for my Facebook app.
I've tried many Facebook queries to graph API, that I've found, but nothing worked as I expected. Can you provide me some example?