Jesus Oliver
Jesus Oliver

Reputation: 11

Issue creating app requests on facebook http graph api

When trying to create app requests through facbeook http graph api I'm getting the error "(#2) Failed to create any app request".

As described in the documentation (https://developers.facebook.com/docs/graph-api/reference/user/apprequests/) I'm using the URL https://graph.facebook.com/{userid}/apprequests setting in post the access token, a title and a message. I've tried different combinations of parameters just to check if I needed anything else, but just if I remove access token and/or title I get different errors.

In addition to that, if I use my own userid, instead of other userid (obviously a friend) that I want to send the request to, there's no error at all, but no request is created.

I don't think it may be related with permissions because both users (source and destination of the request) are admin, developer or tester of the app.

Thank you

Upvotes: 0

Views: 68

Answers (2)

Jesus Oliver
Jesus Oliver

Reputation: 11

Just in case anyone needs it, the problem is that user apprequests can only be created if using any facebook ui methods. That's why in this thread Apprequest of Android Facebook sdk 3.0 comment 1 advices to use webdialog instead of sending the request in code.

Upvotes: 1

Jesus Oliver
Jesus Oliver

Reputation: 11

More on this topic, I've been researching and I found out that I started with my app really long ago (using API lower than 2.3) so I didn't need to set the category as "game" to be able to send apprequests. I updated its category and after multiple tests I've found the following scenarios:

  • Javascript API works correctly to send requests in my app
  • Graph API fails to send requests if using user auth token getting the same error as before
  • Graph API is able to send requests if using app auth token (from app_id + app_secret)

As far as I've read, there's no limitation in using either kind of auth tokens for apprequest calls.

In addition, my app will be running in web, desktop and mobile. The scenario in which I'm using graph API directly is desktop for obvious reasons (there's other APIs tor the other platforms). As recommended in the FB api documentation, the app secret should not be included in binary code deployed to users, so I would need to use the user auth token.

Any help would be apreciated

Thanks

Upvotes: 0

Related Questions