author Jang Ryeol, ryeolj5911 gmail import request = require ( 'request' ) ; import InvalidFbIdOrTokenError from './error/InvalidFbIdOrTokenError' ; export function getFbInfo ( fbId , fbToken ) { return new Promise ( function ( resolve , reject ) { request ( { url : "https://graph.facebook.com/me" , method : "GET" , json : true , qs : { access_token : fbToken } } , function ( err , res , body ) { if ( err || res . statusCode != 200 || ! body || ! body . id || fbId !== body . id ) { return reject ( new InvalidFbIdOrTokenError ( fbId , fbToken ) ) ; } else { return resolve ( { fbName : body . name , fbId : body . id } ) ; } } ) ; } ) ; }