简体   繁体   English

使用facebook javascript sdk将访问令牌添加到FQL

[英]Adding an access token to an FQL using the facebook javascript sdk

I am making an FQL facebook call via the javascript sdk in the following way: 我正在通过javascript sdk以以下方式进行FQL Facebook调用:

FB.api(
       {
       method: 'fql.query',
       query: 'SELECT uid2 FROM friend WHERE uid1 = me()'
       },
       function(friendData) {
       //Call back code
       }
       );

I can't figure out how to include my access token. 我不知道如何包括我的访问令牌。 Can someone help me out with the syntax for that? 有人可以帮我解决这个问题吗?

The AcessToken is provided by the function FB.login, where you define the permissions that you need, and then, the user accepts it, generating an AcessToken. AcessToken由功能FB.login提供,您可以在其中定义所需的权限,然后用户接受它,从而生成AcessToken。 So, after that, you can make your Graph request 因此,在那之后,您可以发出Graph请求

This solved it: 这解决了它:

FB.api(
       {
       method: 'fql.query',
       query: 'SELECT uid2 FROM friend WHERE uid1 = me()',
       access_token:accessToken
       },
       function(friendData) {
       //callback code
       }
    );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM