开发者

Make a Callback in Facebook PHP SDK

开发者 https://www.devze.com 2023-02-13 17:09 出处:网络
I\'m using the PHP SDK on my site to let the users login using their FB acc. After clicking on the login button there is a popup which asks for basic permissions. If the user click on Allow, my app c

I'm using the PHP SDK on my site to let the users login using their FB acc.

After clicking on the login button there is a popup which asks for basic permissions. If the user click on Allow, my app can get the required data, it works all very well.

I'd like to make a callback for when the user click on the "Don't allow" button to开发者_StackOverflow show a message "For logging in to this website you have to provide us basic information. Please try again."

I know it's possible, i saw it once at another page, but after 2 hours of desperate search i decided to step back to SO :)

Thanks in advance!

DC


In the doc for the login function, there is a parameter

* - cancel_url: the url to go to after the user cancels
*
...
  public function getLoginUrl($params=array()) {

Which seems like it would do the trick. So you would invoke with something like

getLoginUrl(array(
  'cancel_url' => 'http://yoursite.com/deny_callback.php', 
   ...


yes like brian says, in that cancel url you can put any message too, you can use the same index.php or like:

getLoginUrl(array(

  'cancel_url' => 'http://yoursite.com/index.php?message=For logging in to this website you have to provide us basic information. Please try again&try_outs=1',

or something like that.

0

精彩评论

暂无评论...
验证码 换一张
取 消