I have build a facebook app (very simple) and would now need that a user can be logged in that way, that at least his ID would be stored as user in the database.
So, inside facebook, he could find his questions again.
As far as i understand, I wouldnt need a password for that user, as he already is logged in into facebook. I have an array with his public data including name and ID and I can get a facebook generated email as well.
Same would be for a user who logges in on the normal website through facebook login.
Once logged in to facebook, the function would just ask if user id allready in database,
if Yes, so log him in without password
if No, store his ID and email in database, log him in.
Second, when he logs out from facebook, I have an event, where I just would need to activate an matching logout function.
Only important thing:
The login function should not replace the normal one, as so because of the missing password, everybody could login that way.
Here is the code I receive from facebook-login: In case he logs in from normal website.
window.fbAsyncInit = function() {
FB.init({appId: 'xxxxxxxxxxx', status: true, cookie: true, xfbml: true});
/* All the events registered */
FB.Event.subscribe('auth.login', function(response) {
// do something with response
login();
});
FB.Event.subscribe('auth.logout', function(response) {
// do something with response
logout();
});
FB.getLoginStatus(function(response) {
if (response.session) {
// logged in and connected user, someone you know
login();
}
});
};
May be it is very chaotic, how I am thinking, but as far as I understand, with this two functions for facebook users only, and avoiding a passowrd everything would be done.
However, if it is not possible or too time consuming, please point me in the right direction.
The opportunities with q2a in combination with facebook are fascinating, if someone is interested in further reading I highly recommend the
http://thinkdiff.net/ tutorials , the only ones I could find which really have working resuts under the newest facebook changes.
Regards
monk333