Facebook openID 为公司进行身份验证?
我一直在我的网站上实施 Google/Facebook 身份验证系统。我使用他们各自的服务来验证用户身份,然后使用结果在我这边实例化会话。 Google 运行没有问题,但 Facebook 却遇到了障碍。
我可以毫无问题地对用户进行身份验证,但是当尝试对公司或其他 Facebook 页面类型进行身份验证时,它会失败。
例如,使用 GraphAPI,我能够检索其示例之一中显示的值 https://graph.facebook .com/btaylor 并妥善保存。
但是当我尝试使用相同的系统来验证公司时( https://graph.facebook.com/nike 例如),它会失败,因为对象不是 GraphAPI 返回的用户结果的一部分。
设置调用的正常内容:
$FBcookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET);
$user = json_decode(file_get_contents_curl('https://graph.facebook.com/me?access_token='.$FBcookie['access_token']));
并且在存储结果时,它作为用户工作正常:
$_Fname =$user->first_name;
$_Lname =$user->last_name;
但是尝试访问上面耐克示例中看到的预期属性,不会返回任何内容。
我什至尝试回显该对象以查看那里有什么:
print('<pre>');
print_r($user);
print('</pre>');
对于用户,我看到一切,对于非用户(公司、事件或其他页面类型),我什么也看不到。
问题是,有谁看到我们可能需要通过 GraphAPI 查询哪些其他对象? Facebook 开发者页面到处都是,并且没有关于这方面的真正简洁的教程。
任何帮助将不胜感激;)
I have been implementing a Google/Facebook authentication system on my site. I use their respective service to authenticate the user, then use the results to instantiate sessions on my end. The Google one is running no problem, but for the Facebook one I have hit a snag.
I can authenticate users with no problem, but when trying to authenticate a company or other Facebook page type, it fails.
For instance, using the GraphAPI, I am able to retrieve the values shown in one of their examples https://graph.facebook.com/btaylor and store it properly.
But when I try to use the same system to authenticate a company ( https://graph.facebook.com/nike for instance), it fails since the objects are not part of the user results returned by the GraphAPI.
Normal stuff setting up the call:
$FBcookie = get_facebook_cookie(YOUR_APP_ID, YOUR_APP_SECRET);
$user = json_decode(file_get_contents_curl('https://graph.facebook.com/me?access_token='.$FBcookie['access_token']));
And when storing results, it works fine as a user:
$_Fname =$user->first_name;
$_Lname =$user->last_name;
But trying to access the expected attributes seen at the Nike example above, nothing gets returned.
I even tried echoing out the object to see whats there:
print('<pre>');
print_r($user);
print('</pre>');
For the user, I see everything, for non-user (company, event or other page type), I see nothing.
Question is, has anyone seen what other objects we may need to query via the GraphAPI? The Facebook developer pages are all over the place and have no real concise tutorials on this.
Any help would be much appreciated ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
facebook 上的公司/页面信息如下:
因此
$user->first_name;
和$user->last_name;
不存在。你可以尝试这样的事情:
Company/Page info on facebook is as follows:
So
$user->first_name;
and$user->last_name;
don't exist.You could try something like this :