flp

facebook-login-promises

Simple library for Facebook Login. Callback and Promises approaches. Init, Login, Logout Check Status, Fetch User Info

Showing:

Popularity

Downloads/wk

11

GitHub Stars

1

Maintenance

Last Commit

5yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

25.8KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

facebook-login-promises

Simple library for Facebook Login. Callback and Promises approaches are used.

Init, Login, Logout, Check Status, Fetch User Info

Welcome

Package is in development state. Feel free to open pull request and/or propouse new features, bug-fixing, etc. It's under MIT license.

Installation

$ npm install facebook-login-promises

How to use?

Callback approach

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);
}

Promises approach

[In development]

[TODO]

Examples

Open https://rawgit.com/gzoreslav/fb-login/master/examples/index.html and see output in console

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100