npm

Need private packages and team management tools?Check out npm Orgs. »

@coolgk/facebook-sign-in

1.0.3 • Public • Published

@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

install

npm i @coolgk/facebook-sign-in

Downloadsweekly downloads

4

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability