我需要在Facebook API中使用访问令牌吗? [英] Do I need to use access token in Facebook API?
问题描述
据我了解,如果我需要向facebook API发出请求,则需要随其传递访问令牌.
From what I understand if I need to make request to facebook API I need to pass access token with it.
但是,我只是看了一下Facebook官方示例-他们没有提供包含访问令牌来发出请求?
However, I just had a look at the Facebook official example - they did not provide include access token to make request?
$user_profile = $facebook->api('/me');
我需要在何时何地使用访问令牌?
Where and When do I need to use access token for?
推荐答案
您提供的示例使用的是PHP-SDK.它会根据需要自动附加access_token
.
The example you've provided is using the PHP-SDK. It automatically appends an access_token
as required.
您只需要担心权限上下文中的令牌,这取决于您正在执行的操作.文档将告诉您是否/何时需要许可/令牌,例如用户文档.您不需要访问前7个字段的权限,但是要查看用户列出的languages
,您需要请求user_likes
权限.
You only need to worry about tokens in the context of permissions, depending on what you're doing. The docs will let you know if/when you need a permission/token an example is the user doc. You don't need permission to access the first 7 fields, but in order to see what languages
the user has listed, you would need to request the user_likes
permission.
如果要直接对图形进行cURL调用,则需要记住将标记附加到URL.
If you're making cURL calls directly to graph, then you'll need to remember to append tokens to the URL.
这篇关于我需要在Facebook API中使用访问令牌吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!