Skip to content

Instantly share code, notes, and snippets.

@yamikuronue
Created December 19, 2015 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yamikuronue/ca7b9518e182c945831e to your computer and use it in GitHub Desktop.
Save yamikuronue/ca7b9518e182c945831e to your computer and use it in GitHub Desktop.
Facebook authentication
app.get('/', function (req, res) {
request('https://graph.facebook.com/v2.5/oauth/access_token?client_id=[redacted]&client_secret=[redacted]&grant_type=client_credentials', function (error, response, body) {
body = JSON.parse(body);
if (!error && response.statusCode == 200) {
res.render('home', {access_token: body.access_token, temp: 'hello world'});
}
})
});
$(document).ready(function() {
$.ajaxSetup({ cache: true });
$.getScript('http://connect.facebook.net/en_US/sdk.js', function() {
FB.init({
appId: '[redacted]',
version: 'v2.5'
});
FB.api('/CleZep/Events', 'GET', {access_token: '{{access_token}}'}, function(response) {
console.log(response);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment