维护网站的活动 FB 身份验证会话
我发现了几个与我的问题有点相似的问题,但不是100%。
我有一个拥有普通用户帐户的网站。您也可以选择使用 FB 身份验证。问题通常是当用户访问该页面时(有时甚至在几个小时后),即使用户帐户 cookie 仍然有效,但他们的 Facebook 会话却不再有效。
因此,用户似乎已登录(网页显示“嗨,[用户]”),但我没有 facebook 会话,并且任何 facebook API 调用都会失败,直到他们重新单击“使用 facebook 登录”。 ——尽管我仍然登录 Facebook,但这一切都是如此。
现在,我大约 11-9 个月前做了类似的实现,并且 facebook 会话很少过期。现在似乎每隔几个小时就会发生一次。奇怪的是,其他使用 facebook auth 的网站似乎没有遇到这个问题。
知道我能做些什么来让 Facebook 会话尽可能长时间地保持活动状态吗? 谢谢, 缺口
I've found several questions that are sort of similar to mine, but not 100%.
I've got a site which has normal user accounts. You have the option of using FB auth as well. The problem is often when the user visits the page (sometimes even after a few hours) even though the users account cookie is still valid, their facebook session is not.
So the user appears to be logged in, (the webpage says "Hi, [user]") but I have no facebook session, and any facebook API call will fail until they re-click "login with facebook". -- This is all despite the fact that I'm still logged in to facebook.
Now, I did a similar implementation about 11-9 months ago, and the facebook session rarely ever expired. Now it seems to happen every few hours. Oddly, other websites which use facebook auth don't seem to be suffering from this problem.
Any idea what I can do to keep the facebook session alive for as long as possible?
Thanks,
Nick
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大多数人将 php-sdk 与 js-sdk 结合起来。这会查找身份验证事件,通常会触发页面重新加载,使用户重新登录 facebook
开发者网站上有一些示例代码,位于以下锚点
https://developers.facebook.com/docs/guides/web/#insights
Most people combine the php-sdk with the js-sdk. This looks for auth events and will usually trigger a reload of the page signing the user back in to facebook
There's some sample code on the developer site, just above the following anchor
https://developers.facebook.com/docs/guides/web/#insights