Open De-Lac opened 8 years ago
and... neither the fields selection worked for me. I had to change it.... now in openfb.js I have
function api(obj) {
var method = obj.method || 'GET',
fields = obj.fields || {},
xhr = new XMLHttpRequest(),
url;
// url = 'https://graph.facebook.com' + obj.path + '?' + toQueryString(params); // as was before
url = 'https://graph.facebook.com' + obj.path + '?'
+"fields=" + fields
+"&access_token=" + tokenStore.fbAccessToken;
console.log('openfb '+url); // try to open it in a browser to test
and in my controller I do
ngFB.api({path: '/me', fields:"id, picture, email, gender, first_name, last_name, location"})
.then(function(response)
{...});
Thanks!
This solution worked for me.
I was stuck for days on this issue... I managed to login, but at the first API call ( /me for example), I got the error "
Finally I found the solution. I consider it strange that it seems that just me I got this error. By the way, the problem is in the
openfb.js
library.During the login, I store the obtained access_token in a variable
Then, once I invoke an API call, the function api() is executed, and here I found a problem
So it seems that
params['access_token'] = tokenStore.fbAccessToken;
is not working. I solved cloning the object, so i becomes editable.params = JSON.parse(JSON.stringify(obj));