这是我关于尝试在 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);
});
问题是我总是得到像 { code: 'JSONPARSE', Error: [SyntaxError: Unexpected token <] } 这样的错误信息。请给我一些帮助。