facebook-graphapi-js-connector
Advanced tools
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); | ||
}); | ||
}); | ||
}; |
@@ -43,3 +43,3 @@ { | ||
}, | ||
"version": "1.0.4" | ||
"version": "1.0.5" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3846
80
0