向 Facebook FQL 进行curl 查询需要身份验证吗?
我使用curl 查询Facebook 的FQL 并发生了这种情况:
> curl 'https://api.facebook.com/method/fql.query' -d "query=SELECT+now()+FROM+user+WHERE+name='Barry Carter';"
<?xml version="1.0" encoding="UTF-8"?>
<error_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://api.facebook.com/1.0/ http://api.facebook.com/1.0/facebook.xsd">
<error_code>102</error_code>
<error_msg>Session key invalid or no longer valid</error_msg>
<request_args list="true">
<arg>
<key>method</key>
<value>fql.query</value>
</arg>
<arg>
<key>query</key>
<value>SELECT now() FROM user WHERE name='Barry Carter';</value>
</arg>
</request_args>
</error_response>
我是否需要进行身份验证才能找到用户?在网站上,您可以 无需身份验证吗?
如果我确实需要身份验证,如何获取?我读过 http://developers.facebook.com/docs/authentication 但我需要全部吗 一个简单的卷曲调用?如果是这样,我应该怎么做才能获得授权 令牌?我是否需要存储cookies/等(使用curl的-b和-c标志?)。
这个问题类似于 Facebook API - fql_query,无效会话 但我使用的是直卷曲,而不是 PHP。
我意识到查询应该是 GET,而不是 POST,但我很确定这不是问题。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您执行的几乎所有查询都需要一个身份验证令牌。
如果您只是进行试验,手动获取一个并不难。手动执行此操作的最简单方法是按照您链接的身份验证文档页面的“客户端流程”部分操作,导航到浏览器中的指定 URL,并使用 http://www.facebook.com/connect/login_success.html 作为目标 URL(它只是 facebook.com 上的一个虚拟页面,所以它保证让您通过),然后从地址栏中获取访问令牌。
Yes you'll need to have an auth token for pretty much any query you perform.
It's not that hard to manually acquire one if you're just experimenting. The easiest way to do it manually is to follow the "client-side flow" section of the authentication doc page you linked by navigating to the specified URL in your browser, and use http://www.facebook.com/connect/login_success.html as the target URL (it's just a dummy page on facebook.com, so it is guaranteed to let you through), and then grab the access token from the address bar.