de3
de3

Reputation: 2000

Oauth dialog redirection php in Facebook. How to redirect to app page

I am developing a Canvas application in Facebook in php. When the user allows the permission it's redirected to my site, as the say in the help page https://developers.facebook.com/docs/reference/dialogs/oauth/.

But I don't want to be redirected to my site, I want to be redirected to the facebook page which contains my site in an iframe. How can I do this? It should be quite straightway.

If the user clicks "Allow", they will be directed to
http://www.example.com/response#access_token=...&  expires_in=3600
If the user clicks "Don't Allow", they will be directed to
http://www.example.com/response?
  error=access_denied&
  error_description=The+user+denied+your+request.

I don't want to go to example.com but to facebook.com/app/ID_APP which contains example.com

EDIT:

after Floyd Wilburn's answer, I tried to put my app page but it doesn't work. It gives me an error. While the right URL looks like this

https://www.facebook.com/dialog/permissions.request?app_id=53434949999999&display/=page&next=http%3A%2F%2Fwww.example.com%2Fapp%2F%3Fnext_url%3Dhttp%253A%252F%252Fapps.facebook.com%28403a2224870942%252F&response_type=code&fbconnect=1&perms=email%2Cread_stream

(we can see the my site url example.com encoded with a parameter 'next_url' to which the user will b redirected from my site page)

the URL of the wrong way looks like this (Just changin my site to my facebook app url )

https://www.facebook.com/dialog/oauth?client_id=185340534870942&redirect_uri=http%3A%2F%2Fapps.facebook.com%2F534349499999s992%2Fhello.php

So my solution is what I commented. The user gets to my site and is redirected to the facebook app URL.

Anyone can guess why Floyd Wilburn's solution doesn't work for me?

Thanks

Upvotes: 2

Views: 4344

Answers (1)

Floyd Wilburn
Floyd Wilburn

Reputation: 1842

Just set the redirect_uri parameter to point at http://apps.facebook.com/yourapp/somepage and it will go there instead.

Upvotes: 2

Related Questions