facebook php sdk getuser() 返回 0
似乎最近 facebook 应用程序注册/登录开始挂起一点,然后返回 0。
使用以下方法构建我的登录 url
$data['loginUrl'] = $this->facebook->getLoginUrl(array('scope' => 'read_stream,publish_stream,status_update',
'redirect_uri'=>base_url()."social/walkup/facebook_save/")
);
,当我通过此链接引导用户时,他们会跳到我的 facebook_save 方法 - getUser() 是返回 0 - url 参数包含状态和代码方法 - 但似乎 getUser() js 挂起 - 页面渲染需要几秒钟,然后返回 0 -
新页面中的第一行是
$user_details = $this->facebook->getUser();
if($user_details){ //user is logged in
if 语句返回 false尽管用户已接受该申请?这是 Facebook 的错误还是有什么提示?
有时工作正常,有时则不行
seems as of late facebook app registration/login is starting to hang a bit and then return 0.
building my login url using the following method
$data['loginUrl'] = $this->facebook->getLoginUrl(array('scope' => 'read_stream,publish_stream,status_update',
'redirect_uri'=>base_url()."social/walkup/facebook_save/")
);
and when i direct the user through this link i and they bounce to my facebook_save method- getUser() is returning 0 - the url parameter contains the state and code method- but it seems getUser() js hanging- takes a few seconds for the page to render and then it returns 0-
the first line in the new page is
$user_details = $this->facebook->getUser();
if($user_details){ //user is logged in
the if statement returns false even though the user has accepted the application? is this a facebook bug or any tips?
it some times works fine and some times doesnt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 PHP 5.4,则必须编辑 base_facebook.php
https://www.webniraj.com/2012/12/19/facebook-php-sdk-fixing-getuser-on-php-5-4-x/
If you're using PHP 5.4, you must edit your base_facebook.php
https://www.webniraj.com/2012/12/19/facebook-php-sdk-fixing-getuser-on-php-5-4-x/
已经发现,如果您使用“Facebook 上的应用程序”数据配置 Facebook 应用程序,然后访问 Canvas 页面 url,突然一切都开始正常工作。即使您通过直接 url 访问您的网站,getUser() 也会返回它应该返回的内容。
Have found out, that if You configure Facebook Application with "App on Facebook" data, and then visit Canvas Page url, suddenly everything start to work ok. The, even if You visit Your site via direct url, getUser() returns what it should.