Saturday 1 April 2017

node.js Facebook SDK OAuthException

I want to create a server with node.js to cache data like public page feed from Facebook graph API. I need this, because I wanted to make an Android app which pulls a page feed with app access code, but because the app secret should not be used in such app which can be decompiled, I must have an dedicated application server

I'm trying to use tenorviol's node.js SDK but I also have tried all other SDK's for node.js listed on the website of facebook. But I couldn't run any code without getting request or oAuth errors.

I took the app id and secret (MYAPPID and MYAPPSECRET respectively) from my profile page at developers.facebook.com

Also, is there a better way to do this? I'm thinking is "node.js + facebook Node.js SDK + NoSQL" faster than "Apache + NoSQL + PHP facebook SDK" for caching results?

Example:

var fbsdk = require('facebook-sdk');

var facebook = new fbsdk.Facebook({
  appId  : ''MYAPPID',
  secret : 'MYAPPSECRET'
});

facebook.api('/me', function(data) {
  console.log(data);
});

Then I run with node index.js:

{ result:
   { error:
      { message: 'An active access token must be used to query information about the current user.',
        type: 'OAuthException',
        code: 2500,
        fbtrace_id: 'DPWsuCVegfz' } },
  error: true,
  code: 0,
  message: 'An active access token must be used to query information about the current user.' }



via Classicpal

No comments:

Post a Comment