如何向我当前的 Facebook 应用程序用户请求额外许可?
我正在使用此代码向用户请求我的应用程序的许可,
$app_id = "1231654321654121";
$canvas_page = "http://apps.facebook.com/manydldotnet/";
$auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page) . "&scope=email,read_stream";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
}
但现在我需要向当前用户请求“publish_stream”权限, 我向范围参数添加了“publish_stream”权限,但对于之前已经授予应用程序权限的用户来说,它不起作用。
那么我该如何解决这个问题呢?
谢谢...
i am using this code to ask users for permission for my app
$app_id = "1231654321654121";
$canvas_page = "http://apps.facebook.com/manydldotnet/";
$auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . urlencode($canvas_page) . "&scope=email,read_stream";
$signed_request = $_REQUEST["signed_request"];
list($encoded_sig, $payload) = explode('.', $signed_request, 2);
$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
if (empty($data["user_id"])) {
echo("<script> top.location.href='" . $auth_url . "'</script>");
}
but now i need to ask the CURRENT users for "publish_stream" permission,
I added the "publish_stream" permission to the scope parameter but it is not working for the users already gave the app a permission before.
so how can i fix this?
thanks...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
显然,一旦用户授权您的应用,
user_id
将始终出现在signed_request
中。因此,您需要检索用户的权限并进行检查。这是一个示例:
更多内容可以在我的教程中找到:如何:检查用户是否具有特定权限 – Facebook API
Obviously once the user authorize your app, the
user_id
will always be present in thesigned_request
. So you need to retrieve the user's permissions and check against that.Here's an example:
More can be found on my tutorial: How to: Check if User Has Certian Permission – Facebook API
我非常确定,一旦您将请求的新权限添加到您的范围,Facebook 将自动通过应用程序的请求访问对话框再次提示它们,并且用户只需批准它们即可。
I'm pretty sure once you add the new permissions you are requesting to your scope, facebook will automatically prompt them again with the app's request access dialog and the user just has to approve them.