Titanium (Android) - Invite Facebook-Friends -> error - javascript

i have an problem with my Appcelerator Titanium. I want to use the Facebook API to send Invites to a User's friends, but i always get the same error.
Here is my code, i have no special Facebook permissions set (maybe i have to?):
function sendRequestViaMultiFriendSelector() {
Ti.App.fb.dialog('apprequests', {message: 'my custom message'}, function(data) {
alert(data);
});
}
And this is the error i after sending the request via the Facebook Dialog:
{cancelled=true, success=false, code=-1}
I've googled this error, then i've found this:
Appcelerator Error Ticket
So i think, maybe thats the problem, but this ticket ist from Sept '13. It's still open, but i thought maybe it's solved, after over a year. Does anyone have an fix for my problem ? Thank you for your time!

It seems that you don't have the needed permissions. I guess you need these at least:
fb.permissions = ['publish_stream'];
fb.authorize();
I think you use the Titanium Facebook module(?). You should definitely check the documentation since it is very detailed.

Related

Unable to retrieve user's mysite URL OneDrive explorer javascript problem

I have some strange problem with onedrive explorer:
https://github.com/OneDrive/onedrive-explorer-js
I have configured my app credentials, have added the permissions:
Files.Read
Files.Read.All
offline_access
profile
Sites.Read.All
User.Read
and get this error:
https://graph.microsoft.com/v1.0/me/drive/root?expand=thumbnails,children(expand=thumbnails(select=large))
502
Bad Gateway
additional error text:
Unable to retrieve user's mysite URL.
I have tried with 3 different accounts.
Additionally, on graph explorer I have an error :
Must be authenticated to use '/drive' syntax (It gives my profile details and nothing else) from -
https://developer.microsoft.com/en-us/graph/graph-explorer
Can somebody let me know what could be the problem?
Thank you !
Problem is in the azure subscription, not in any of the accounts. I have created new subscription and all is fine. Seems that this use case or test cannot be done for free.
Thanks for the collaboration :)

Appcelerator Titanium: Facebook Graph API empty Friends list

another problem with the Facebook connection from Titanium.
I make an request to Facebook with Graph API, but I only get an empty result:
SUCCESS; {"data":[]}
This is my code:
Ti.App.fb.requestWithGraphPath('me/friends', false, 'GET', showRequestResult);
I've also tried to use the request example from KitchenSink, but that's not working, because the method is turned for my FB SDK.
So, I've tried to update the permissions for facebook with "user_friends" but if I log in, it's not asking for this permission.
Any Ideas?
Thanks for your help.
The reason why it doesn't work was that i have to get the Facebook permission "user_friends".

Can't post to FB using Koala (Graph API)

I'm attempting to post to a Facebook group using the Koala Gem.
I am the administrator of the group. I log in using Facebook Javascript SDK.
Before posting, I check permissions and have "publish_actions".
However, when posting I still get a 200 message ("message: (#200) Insufficient permission to post to target on behalf of the viewer [HTTP 403]):")
I've been struggling with this for a couple days. Can anyone provide me with some insight?
Below is the code I'm using for permissions and to post.
graph = Koala::Facebook::API.new(current_user.fb_token)
permissions = graph.get_connections('me','permissions')</code>
The array contains {"permission"=>"publish_actions"}
graph = Koala::Facebook::API.new(current_user.fb_token)
message = "#{#group.name} - #{#message.message} - #{advertisement.message}"
graph.put_connection("#{fb_group_id}", "feed", message: message)
Should have updated awhile ago; forgot I left this.
The code was correct. It's an API restriction. Unfortunately it will work in a development (test) account, but won't work in a production account.

Firebase error after logout

I'm currently developing a little Website with Firebase. I got a couple of HTML files and each file contains a logout button which calls the function
function logout(){
auth.logout();
console.log("logout successfull");
location.href="index.html";
}
After getting redirected I tried to login again but it always failed with the following error message:
Error: FirebaseSimpleLogin: An unknown server error occurred.
It took me some time to realise that the redirection to the index page caused the problem. When I delte the location.href="index.html"; line, everything works fine.
Problem is, I really need something that redirects me to the front page, when the user isn´t loged in. Is this a known problem and/or can someone come up with a solution to this problem?
Thanks in advance :)
PS.: I realised that I could "fix" the problem (after getting redirected to the index page) when I cause an error (f.e. calling a undefined function). Idk if this information helps...
Ok, thanks for your reply Kato!
I changed quite a lot, since I started the "project". Instead of using mutliple HTML files I copied everything into the index.html and work now with mutliple (hidden) DIVs.
But unfortunatly, the problem still exists.
I offer two different Login possibilites. One with Facebook (works 100% of the time for me) and one with the SimpleLogin (works barely).
I´m pretty sure I did the initialization the same way like it´s done in the tutorials on firebase.com.
This is how I connect to the Firebase DB
var ref = new Firebase('https://partyfinder-db.firebaseio.com/');
var auth = new FirebaseSimpleLogin(ref, function(error, user) {
if (error) {
// an error occurred while attempting login
alert(error);
} else if (user) {
// Here I work with user.id etc.
} else {
// user is logged out
}
});
And that is how I try to login the user...
function login() {
//I probably should use jQuery here...
var _email = document.getElementById("emailLogin").value;
var _pw1 = document.getElementById("passwordLogin").value;
var _rememberMe = document.getElementById("rememberMe").checked;
auth.login('password', {
email: _email,
password: _pw1,
rememberMe: _rememberMe
});
showMain(); //Hide and show DIVs and stuff...
}
I call this function on the SignIn Button. The whole Javascript file is linked in the head part of the HTML file.
So, calling this function is normally causing the following error
Error: FirebaseSimpleLogin: An unknown server error occurred.
I already figured out that this message only shows up when the connection to the DB already was successful. For example, when I type in an invalide email adress, the following message appears:
Error: FirebaseSimpleLogin: The specified user does not exist.
There are a few things that can "fix" the problem. For example, when I use the Facebook Login and logout after this was successful, I can sign in using firebase simpleLogin. Sometimes (unfortunatly not always) it helps when I`m causing an error, f.e. calling a non existing function. After the error message is displayed in the console, I can continue logging in (successfully).
But to be honest I`ve absolutly no idea what this tells me about the error and if this is somehow a hint to the solution. I also tried to set some breaking points and debug through the relevant code (using google chrome) but didn´t find anything.
I uploaded the page to a free webspace, where you can test this whole thing by yourself.
But please note, this project is just for testing purpos. I´m not planning to release it somehow, it´s just for me to figure out multiple things and I find it easier to learn something when I can set it in a context. I´m pretty sure it´s quite bad coded and contains many mistakes, etc. But I´m always grateful for feedback beside the actual problem :)
For the login you can use
email: user#email.com
password: user
If you use the FB-Login, your Name and your email adress will be saved to the Database (but I can delete this section of the code if you want/need to use it and feel uncomfortable about it).
http://partyfinder.lima-city.de/
Most of the comments are in german, sorry for that...

Facebook Feed Dialog: Post not showing up on friend's wall even though I get a response id

I am creating an app on facebook and I am trying to post to a friend's wall. I'm using the facebook javascript SDK and the FB.ui method to do this. In short here is my code:
function test() {
var obj = {
method: 'feed',
to: '######'
};
function callback(response) {
alert(response['post_id']);
}
FB.ui(obj, callback);
}
Note that I made this code very simple for testing purposes.
When I run it, a facebook feed dialog opens correctly and at the top says "Post Story to friendsname's Wall". I type in a message and press Share. My alert pops up with a response['post_id'] number. Because there is a response['post_id'] the story should've been posted successfully right? However when I navigate to the friend's wall there is no story. I've tried this multiple times in slightly different ways and haven't been able to get it to work. If I remove the 'to' parameter and simply post to my own wall it -does- work. So for some reason, posting to a friend's wall breaks it?
I know it's a rather broad question but I was wondering if anybody had any ideas why this doesn't work. Thanks
I suspect the problem may be because your application is in sandbox mode - https://developers.facebook.com/docs/ApplicationSecurity/
When testing your apps, place them into Sandbox Mode. This hides your
app entirely from all users who you have not authorized in the
developer app to see the app, for the roles described below. Please
note that when your app is in Sandbox Mode, you cannot call any API
calls on behalf of users who cannot see your app.
Basically, if your application is in sandbox mode, nothing your application does can be seen by users who have not authorized your application or by users that have not been specifically listed in the "roles" within your applications settings.
Remove you application from sandbox mode or add some users to specific "roles" within your application.

Categories

Resources