Facebook 应用程序保留以前的用户详细信息
我在使用 Facebook Iframe 应用程序时遇到问题。我的问题是,如果用户登录到应用程序,然后注销应用程序并且另一个(不同的)用户登录,则 $facebook->getUser() 返回前一个用户的 id。
我尝试每次将用户发送到登录网址,但它仍然会发生,直到页面刷新一次(第一次登录应用程序需要以前的用户 fb 会话,然后就可以了)。
我能找到的唯一线索是,这是由于 $facebook->getUser() 方法中的持久数据而发生的......
也许有人可以帮助阐明这个问题,因为很多次之后我无法找不到解决办法... 谢谢!
I'm having a problem with a facebook Iframe application. My problem is that if a user logs in to the app, then logs out of the application and another (different) user logs in, the $facebook->getUser() returns the id of the previous user.
I tried to send the user to the login url each time, but it still happens untill the page is refreshed once (first login to app takes the previous user fb session, then its ok).
The only lead I was able to find was that this happens due to the persistent data in the $facebook->getUser() method...
Maybe someone can help shed some light on this matter, as after a lot of times I couldn't find a solution...
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在正确使用 facebook PHP SDK。
在 facebook php sdk 中,当您调用
$facebook->getUser() 方法时,它首先检查它是否是私有变量,如果用户已经设置或没有,这里是方法,
所以如果您是第一次调用,当然
user< /code> 变量为
null
所以现在它调用 getUserFromAvailableData();方法
和 getSignedRequestCookieName() 返回,
因此现在
getSignedRequest()
函数首先检查是否设置了签名请求,如果没有设置它从 Cookie 获取签名请求如果最后你不想获取以前的用户 ID,只需删除名为
''fbsr_'+YourApplicationID'
的 cookieYou are using facebook PHP SDK right.
In facebook php sdk when you call the
$facebook->getUser() method it first check it it's private variable if user already set or not here is the method
so if you are call the first time of-course
user
variable isnull
so now it call getUserFromAvailableData(); method
and the
getSignedRequestCookieName()
returnso now
getSignedRequest()
function first check whether signed request is set or not if not set it get signed request from Cookieso if finally if you not want to get previous userid just delete cookie named
''fbsr_'+YourApplicationID'