Simple library for Facebook Login. Callback and Promises approaches are used.
Init, Login, Logout, Check Status, Fetch User Info
Package is in development state. Feel free to open pull request and/or propouse new features, bug-fixing, etc. It's under MIT license.
$ npm install facebook-login-promises
import fb from 'facebook-login-promises';
const params = {
appId: <fb_app_id>
};
function callback(state) {
console.log(state);
const process = state.loading ? 'loading' : 'loaded';
const connected = state.status === 'connected';
const firstname = state.data ? state.data.first_name : null;
console.log('process: ' + process);
console.log('connected: ' + connected);
if (firstname) {
console.log('your logged as: ' + firstname);
}
}
cunction login() {
fb.callback.login(params, callback);
}
function logout() {
fb.callback.logout(params, callback);
}
function checkStatus() {
fb.callback.checkStatus(params, callback);
}
[In development]
[TODO]
Open https://rawgit.com/gzoreslav/fb-login/master/examples/index.html and see output in console