How to get authorize code from facebook using Node js
Problem
Here is my Code about trying to get authorize code in Node js:
var FB = require('fb');
FB.api('oauth/authorize', {
client_id : '160355604145399',
redirect_uri : Convas Url
}, function(res) {
if (!res || res.error) {
console.log('error')
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log(res.code);
});
The problem is I always get error information like { code: 'JSONPARSE', Error: [SyntaxError: Unexpected token
Problem courtesy of: Jianyuan Ma
Solution
You have
tags in the code. Probably from copy pasting. Delete them and it should work.
Solution courtesy of: raam86
Discussion
View additional discussion.