facebook php-sdk 未注销
我很难让它发挥作用。我使用以下内容生成注销 url:
$logout = "https://www.facebook.com/logout.php?next=" . urlencode('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']) . "&access_token=" . $facebook->getAccessToken();
生成正确的(与上一个版本一起使用)url:
https://www.facebook.com/logout.php?next=http%3A%2F%2F...&access_token=AA....ZD
但是,这实际上并没有使用户注销。我尝试使用
$facebook->getLogoutUrl(array('next' => 'myurl'))
它生成几乎相同的网址。这也行不通。我不明白为什么它不注销用户。实际上,我尝试手动将地址放入地址栏中,但它会将我重定向到 Facebook 主页。
I'm having a hard time getting this to work. I use the following to generate the logout url:
$logout = "https://www.facebook.com/logout.php?next=" . urlencode('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF']) . "&access_token=" . $facebook->getAccessToken();
Which generates the correct (worked with the last version) url:
https://www.facebook.com/logout.php?next=http%3A%2F%2F...&access_token=AA....ZD
However this does not actually log the user out. I tried using
$facebook->getLogoutUrl(array('next' => 'myurl'))
which generates pretty much the same url. This also did not work. I am lost as to why its not logging the user out. I actually tried manually putting the address into the address bar but it redirects me to the Facebook homepage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
facebook php sdk 使用 php 会话来保持登录状态。要清除它,您只需销毁会话即可。
index.php:
logout.php
FB_APP_ID 和 FB_SECRET 是我的特定应用程序信息。换成你自己的。
The facebook php sdk uses php sessions to tokens that keep you logged in. To clear it, you can just destroy the session.
index.php:
logout.php
FB_APP_ID and FB_SECRET are my specific apps info. Replace with your own.
如果您在使用 Facebook PHP SDK 时请求 offline_access 权限(有时甚至没有它),则会导致默认注销功能无法正常工作。为了解决这个问题,以下内容对我有用:
If you request the offline_access permission when using the Facebook PHP SDK (and sometimes even without it), it makes the default logout functionality not work very well. To fix this, following worked for me: