Facebook应用程序:附加权限 [英] Facebook Apps: Additional permissions
问题描述
稍后,一小部分用户将会再次使用该应用程序。一些以前不想写墙的人(因此我没有要求publish_stream)现在想写给他们的墙。
如何在用户已经授权应用程序后,我要求另外的许可?
同样,我如何查询用户列出他们已经授权的权限?
简单的添加新的权限到新的 fb:login-button
:
< fb:login-button scope =publish_stream>
让我写在你的墙上!
< / fb:login-button>
所以例如你上面隐藏在DIV中,如果用户勾选一个复选框,你会显示DIV并提示新的权限!
一个很好的直播的例子是在 Facebook Test Console :
- 点击登录以添加应用程序
- 然后点击
示例
- 在
fb.api
选择类似
现在你可以看到即使连接到应用程序(测试控制台应用程序),您 可以 实际上有另一个登录按钮提示用户!
编辑:
要检查用户是否已经授予您的应用程序权限,只需使用此FQL: p>
SELECT read_stream,offline_access FROM permissions WHERE uid = me()
这将返回以下内容:
[
{
read_stream:1,
offline_access:0
}
]
要测试它,只需使用早期发布的测试控制台。
编辑2:
要使用XFBML或Javascript自己构建链接,您只需添加 scope
参数与附加的perms(参考):
https://www.facebook.com/dialog/oauth?
client_id = YOUR_APP_ID& redirect_uri = YOUR_URL& scope = publish_stream
或者如果您使用 PHP-SDK :
$ loginUrl = $ facebook-> getLoginUrl(array(
scope=>publish_stream
));
I have a working Facebook app that most users will use just once. Leading into the Facebook workflow, users indicate if they want their wall to be written to or not. Based on that, I either ask for the publish_stream permission or not.
Later, a small percentage of users will come back and use the app again. Some of the people who previously did not want to write to the wall (and thusly I didn't ask for publish_stream) now want to write to their wall.
How do I request an additional permission after the user has already authorized the app?
Similarly, how can I query a user to list which permissions they have already granted?
It's as simple as adding the new permission to a new fb:login-button
:
<fb:login-button scope="publish_stream">
Let me write on your wall!
</fb:login-button>
So for example you have the above hidden in a DIV and if the user tick a checkbox you show the DIV and prompt the new permission!
A good live example of this is on the Facebook Test Console:
- Click login to "add" the application
- Then click on
examples
- Under
fb.api
choosedoes-like
Now you can see that even after being *connected to the application (test console app), you can actually have another login button to prompt the user!
EDIT:
To check if the user has granted your application a permission, just use this FQL:
SELECT read_stream,offline_access FROM permissions WHERE uid=me()
This would return something like:
[
{
"read_stream": 1,
"offline_access": 0
}
]
To test it, just use the test console posted early.
EDIT 2:
To construct the link yourself without XFBML or Javascript, you just need to add the scope
parameter with the additional perms (reference):
https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=publish_stream
Or if your are using the PHP-SDK:
$loginUrl = $facebook->getLoginUrl(array(
"scope" => "publish_stream"
));
这篇关于Facebook应用程序:附加权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!