Thuzi / facebook-node-sdk

Modeled from the (Facebook Javascript SDK), now with the facebook-node-sdk you can now easily write the same code and share between your server (nodejs) and the client (Facebook Javascript SDK).
Other
737 stars 250 forks source link

Get access token method throwing exception #124

Open satheeshwaran opened 7 years ago

satheeshwaran commented 7 years ago

I am getting the below exception

TypeError: Cannot read property 'name' of null
    at FormData._getContentDisposition (/user_code/node_modules/fb/node_modules/form-data/lib/form_data.js:226:39)
    at FormData._multiPartHeader (/user_code/node_modules/fb/node_modules/form-data/lib/form_data.js:177:33)
    at FormData.append (/user_code/node_modules/fb/node_modules/form-data/lib/form_data.js:70:21)
    at appendFormValue (/user_code/node_modules/fb/node_modules/request/request.js:323:21)
    at Request.init (/user_code/node_modules/fb/node_modules/request/request.js:334:11)
    at new Request (/user_code/node_modules/fb/node_modules/request/request.js:128:8)
    at request (/user_code/node_modules/fb/node_modules/request/index.js:53:10)
    at Facebook.value (/user_code/node_modules/fb/lib/fb.js:479:26)
    at Facebook.value (/user_code/node_modules/fb/lib/fb.js:399:22)
    at Facebook.api (/user_code/node_modules/fb/lib/fb.js:276:16)

on doing this,


FB.api('oauth/access_token', {
    client_id: 'app_id',
    client_secret: 'app_secret',
    grant_type: 'client_credentials'
}, function (res) {
    if(!res || res.error) {
        console.log(!res ? 'error occurred' : res.error);
        return;
    }

    var accessToken = res.access_token;
});
dantman commented 7 years ago

@satheeshwaran This repository is obsolete. Please try upgrading to the current version of the library which is now at: https://github.com/node-facebook/facebook-node-sdk

satheeshwaran commented 7 years ago

@dantman Thanks for the quick reply but the code seems to be the same. Don't know what is wrong.