Facebook 应用程序:附加权限 [英] Facebook Apps: Additional permissions

查看:33
本文介绍了Facebook 应用程序:附加权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个可用的 Facebook 应用,大多数用户只会使用一次.进入 Facebook 工作流程,用户表明他们是否希望他们的墙被写入.基于此,我要么请求 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.

稍后,一小部分用户会回来再次使用该应用.一些以前不想写到墙上的人(因此我没有要求 publish_stream)现在想写到他们的墙上.

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?

推荐答案

就像将新权限添加到新的 fb:login-button 一样简单:

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>

例如,您将上述内容隐藏在 DIV 中,如果用户勾选复选框,您将显示 DIV 并提示新权限!

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!

一个很好的实时示例位于 Facebook 测试控制台:

A good live example of this is on the Facebook Test Console:

  1. 点击登录添加"应用
  2. 然后点击examples
  3. fb.api下选择does-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!


要检查用户是否已授予您的应用程序权限,只需使用此 FQL:


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()

这将返回如下内容:

[
  {
    "read_stream": 1,
    "offline_access": 0
  }
]

要测试它,只需使用早期发布的测试控制台.

To test it, just use the test console posted early.

编辑 2:
要在没有 XFBML 或 Javascript 的情况下自行构建链接,您只需添加带有附加权限的 scope 参数(参考):

https://www.facebook.com/dialog/oauth?
     client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=publish_stream

或者如果您使用的是 PHP-SDK:

Or if your are using the PHP-SDK:

$loginUrl = $facebook->getLoginUrl(array(
    "scope" => "publish_stream"
));

这篇关于Facebook 应用程序:附加权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆