@coolgk/facebook-sign-in
facebook sign in module which verifies client access token and returns account data
Last updated a year ago by coolgk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @coolgk/facebook-sign-in 
SYNC missed versions from official npm registry.

@coolgk/facebook-sign-in

a javascript / typescript module

npm install @coolgk/facebook-sign-in

facebook sign in module which verifies client access token and returns account data

Report bugs here: https://github.com/coolgk/node-utils/issues

Examples

const { FacebookSignIn } = require('@coolgk/facebook-sign-in');
// OR
// import { FacebookSignIn } from '@coolgk/facebook-sign-in';

const facebookSignIn = new FacebookSignIn({
    clientId: '...',
    secret: '...'
});

const invalidToken = '...';
const validToken = '...';

(async () => {
    const account1 = await facebookSignIn.verify(invalidToken);
    console.log(account1); // false

    const account2 = await facebookSignIn.verify(validToken);
    console.log(account2); // { email: 'abc@example.com', id: '123123123123123123' }
})()

FacebookSignIn

Kind: global class
Export:

facebookSignIn.verify(token, [fields]) ⇒ Promise.<(false|object)>

verify access token from clients and return false or account data

Kind: instance method of FacebookSignIn
Returns: Promise.<(false|object)> - - false if access token is invalid otherwise returns account data

Param Type Default Description
token string facebook user's token string
[fields] string "'email'" fields to fetch from user's facebook account. comma separated value e.g. id,name,email

FacebookSignIn.FacebookSignIn

Kind: static class of FacebookSignIn

new FacebookSignIn(options)

Param Type Description
options object
options.clientId string facebook app id
options.secret string facebook app secret

Current Tags

  • 1.0.3                                ...           latest (a year ago)

4 Versions

  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 7
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |