7

I'm developing a game for Facebook. I need a way for users to invite others to the game. For that, I use the apprequests dialog. I redirect the user to the dialog URL, which I glue together like this:

$url = "http://www.facebook.com/dialog/apprequests?app_id=".$id."&message=".urlencode("foobar")."&redirect=".urlencode("http://some.arbitrary.url.com");

(Of course, with not-so-arbitrary arguments, but they still look sane to me.) Upon navigating there, the user is scolded by "API Error Code: 100, API Error Description: Invalid Parameter, Error Message: Requires valid redirect URI.". I googled around for a solution, but it seems that all the people receiving this error were forgetting to escape their URLs / messages. I also tried some URLs that should be accepted without remarks, like the application canvas URL.

Does anyone know what mistakes am I making?

bkaid
  • 51,465
  • 22
  • 112
  • 128
Michal Pokorný
  • 161
  • 1
  • 2
  • 7

3 Answers3

4

So, turns out the solution is to use redirect_uri and not to escape the URL to redirect to, so the code I wrote before should read:

$url = "http://www.facebook.com/dialog/apprequests?app_id=".$id."&message=".urlencode("foobar")."&redirect_uri="."http://some.arbitrary.url.com";
Michal Pokorný
  • 161
  • 1
  • 2
  • 7
2

Try replacing the redirect parameters with redirect_uri

Jose Vega
  • 10,128
  • 7
  • 40
  • 57
  • API Error Code: 191 API Error Description: The specified URL is not owned by the application Error Message: redirect_uri is not owned by the application. That's what I get if I point the redirect_uri to apps.facebook.com/whatever. When I point it to an URL owned by the application, I get the same error as before (100, requires valid URI). – Michal Pokorný Sep 24 '11 at 16:35
  • Is the URL owned by your application? (i.e your app domain is whatever.com, the url must be something.whatever.com/something) – Igy Sep 25 '11 at 09:03
  • Yes, it is. It's actually the exact URL I entered in the developer app. Actually, I thought it might be a problem as well, so I entered some arbitrary URL the app didn't own just to see what error would I be greeted with, and then I received the "redirect_uri is not owned by the application". – Michal Pokorný Sep 25 '11 at 09:18
0

From my experience with this error; facebook gives you same error whatever the parameter which caused the error. my problem that I didn't use encodeURIComponent(contentParam); for all the parameters so any special character in any parameters gave me the above error.

Shady Mohamed Sherif
  • 15,003
  • 4
  • 45
  • 54