Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Access token exception #117

Open
satheeshwaran opened this issue Sep 24, 2017 · 1 comment
Open

Get Access token exception #117

satheeshwaran opened this issue Sep 24, 2017 · 1 comment

Comments

@satheeshwaran
Copy link

satheeshwaran commented Sep 24, 2017

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
Copy link

dantman commented Sep 24, 2017

Strangely the stack trace seems to suggest that the library is trying to send the params using form-data rather than www-form-urlencoded. Which suggests two problems, but which the code sample you provide doesn't actually support.

Firstly, your code sample is not a post, unless you are doing a post none of form data calls in that stack should be getting called.

Secondly, unless you're using upload objects the data should not be getting passed as formData.

Could you first check to make sure that none of the variables you're passing in are null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants