Hi, I want to show a list of friends for any user on their profile page. I did it using friends.search call to the cloud and showing the results in table. On the profile of user logged in, it works and everything is good but when i navigate to my friends profile it gives an error with "You are not authorized to perform this action" alert.
here is my code. thanks in advance.
ps whosprofile is the variable for id of user who's profile page we are opening
Cloud.Friends.search({ user_id: whosprofile, }, function (e) { if (e.success) { for (var i = 0; i < e.users.length; i++) { var user = e.users[i]; var friendusername= user.username; var row = Ti.UI.createTableViewRow(); var background = Ti.UI.createView({ backgroundColor:'#f7f7f7', width: '100%', height: 60, top:5 }); var username = Ti.UI.createLabel ({ width: 200, left: 60, text: friendusername, top: 12, color: '#305053' }); background.add(username); row.add(background); tableDatafriend.push(row); } tablefriend.setData(tableDatafriend); resultstwo.add(tablefriend); } else { alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e))); } });