Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

facebook-graphapi-js-connector

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

facebook-graphapi-js-connector - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

87

index.js

@@ -5,6 +5,85 @@ exports.printMsg = function() {

exports.open = function() {
var url = 'https://www.npmjs.com/';
var start = (process.platform == 'darwin'? 'open': process.platform == 'win32'? 'start': 'xdg-open');
require('child_process').exec(start + ' ' + url);
exports.init = (props) => {
new Promise((resolve, reject) => {
console.log('initializing fb connect');
const {
appId = '',
cookie = 'true',
xfbml = 'true',
version = 'v2.11'
} = props;
window.fbAsyncInit = () => {
FB.init({
appId,
cookie,
xfbml,
version
});
FB.AppEvents.logPageView();
console.log(FB);
resolve();
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
return new Promise((resolve, reject) => {
return FB.getLoginStatus(response => {
console.log('checking login status...');
if (response.status === 'connected') {
//console.log(response, response.authResponse.userID);
resolve(response.authResponse.userID);
} else {
console.log('failed to get user access token', response);
reject();
}
})
})
.then(response => {
console.log(`user ${response} is logged in`);
// this.setState({
// user_id: response.userID,
// user_access_token: response.accessToken,
// user_logged_in: true
// });
}).catch(() => {
console.log('user is not logged in');
})
});
}
exports.login = () => {
return new Promise((resolve, reject) => {
FB.login(response => {
if (response.authResponse) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', response => {
console.log('Good to see you, ' + response.name + '.');
resolve(response);
});
} else {
console.log('User cancelled login or did not fully authorize.');
reject(response);
}
});
});
};
exports.logout = () => {
return new Promise((resolve, reject) => {
FB.logout(response => {
console.log('Goodbye.')
resolve(response);
}).catch((response) => {
reject(response);
});
});
};

2

package.json

@@ -43,3 +43,3 @@ {

},
"version": "1.0.4"
"version": "1.0.5"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc