在php facebook sdk 4.0.0或更高版本中指定应用范围 [英] Specify app scopes in php facebook sdk 4.0.0 or greater

查看:72
本文介绍了在php facebook sdk 4.0.0或更高版本中指定应用范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Facebook(> = 4.0.0)使用新的php sdk,并且试图找出在哪里指定对图api的请求的范围.就像,我在哪里指定我要publish_actions,以便用户登录时可以为此授权我?

I am using the new php sdk for facebook (>= 4.0.0) and I am trying to figure out where to specify the scope of my requests to the graph api. Like, where do I specify I want thepublish_actions so that the user can authorize me for that when logging in?

此链接中说:

登录到 用户.

You must have requested the publish_actions scope when logging in the user for this to work.

那怎么办?

谢谢

推荐答案

就像在以前版本的PHP SDK中一样,您将范围加载到getLoginUrl函数中

It's just like in previous versions of the PHP SDK, you load the scope into the getLoginUrl function

$helper = new FacebookRedirectLoginHelper('your redirect URL here');
$scope = array('publish_actions');
$loginUrl = $helper->getLoginUrl($scope);

https: //github.com/facebook/facebook-php-sdk-v4/blob/4.0-dev/src/Facebook/FacebookRedirectLoginHelper.php#L85

这篇关于在php facebook sdk 4.0.0或更高版本中指定应用范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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