so i wrote this bit of code:
Ti.Facebook.requestWithGraphPath('me?fields=name,picture', {}, 'GET', function(e) {
if (e.success) {
var response = JSON.parse(e.result);
} else if (e.error) {
alert("Error = "+e.error);
} else {
alert('Unknown response');
}
});
var profileView = Ti.UI.createImageView({ image:'https://graph.facebook.com/'+Ti.Facebook.uid+'/picture?type=square', top: 65, left: 20, height:70, });
var url = 'https://graph.facebook.com/me/name';
var httpClient = Titanium.Network.createHTTPClient({ onload: function() { var reply = JSON.stringify(this.responseText); Ti.API.info('user id ' + Titanium.Facebook.uid); Ti.API.info('user name: ' + reply); Ti.API.info('access token: ' + Ti.Facebook.accessToken);
callback(reply);
}
});
httpClient.open("GET",url);
httpClient.send();
basically what i want to achieve is to show the users name from Facebook
upon running the app i get the following error:
[INFO] user name: "{\"error\":{\"message\":\"An active access token must be used to query information about thecurrent user.\",\"type\":\"OAuthException\",\"code\":2500}}"
my question is where to i place the access token (as you can see i have found what the access token is via Ti.API.info('access token: ' + Ti.Facebook.accessToken);
but i don't now how to implement it
2 Answers
what aren't you using the buit in Facebook API calls?
http://docs.appcelerator.com/titanium/2.1/#!/api/Titanium.Facebook
https://github.com/appcelerator/KitchenSink/tree/master/Resources/ui/common/mashups
look at the facebook samples
Your Answer
This question has been locked and cannot accept new answers.