Facebook graph api Facebook-是否授予累积权限? 上下文
根据我的理解,我应该在初始登录页面上请求一组最小权限,并在真正需要时延迟扩展权限的请求 比如说。假设我对两个扩展配置文件属性的原始登录请求:Facebook graph api Facebook-是否授予累积权限? 上下文,facebook-graph-api,facebook-javascript-sdk,Facebook Graph Api,Facebook Javascript Sdk,根据我的理解,我应该在初始登录页面上请求一组最小权限,并在真正需要时延迟扩展权限的请求 比如说。假设我对两个扩展配置文件属性的原始登录请求: <fb:login-button show-faces="true" width="200" max-rows="1" scope="user_photos, friends_photos"> </fb:login-button> 执行第二次权限检查,查看用户是否已授予新权限。如果用户已授予新权限,请执行上载,否则将显
<fb:login-button show-faces="true" width="200" max-rows="1"
scope="user_photos, friends_photos">
</fb:login-button>
publish\u操作
,还是同时请求已经授予的权限
{scope: 'user_photos, friends_photos, publish_actions'});
user\u photos,friends\u photos
)。如果用户授予发布操作,我是否应该在上传之前再次完成整个服务器端过程(使用新的短期访问令牌)
GET /oauth/access_token?
grant_type=fb_exchange_token&
client_id={app-id}&
client_secret={app-secret}&
fb_exchange_token={new-short-lived-token}
或者,新的许可证会立即用于长寿命代币吗向任何面临同样问题的人回答我自己的问题 是,授予的权限是累积的
发布\u操作
还是同时请求已授予的权限
{scope: 'user_photos, friends_photos, publish_actions'});
我只需要请求新的权限。以前授予的权限仍然可用publish\u操作
(使用FB.login
),我是否应该在上传之前再次完成整个服务器端令牌交换过程(使用新的短期访问令牌)?或者,新的许可证会立即用于长寿命代币吗
客户端调用FB.login
就足够了。如果用户授权发布操作,我可以使用以前存储的服务器端令牌发布内容一个小问题是:当你调用
FB.login
时,用户可能会再次跳过权限(它将返回response.status==“connected”
)。所以我必须仔细检查权限:
用于检查回调权限的函数:
假设photoUpload
是一个需要publish\u actions
权限的函数,下面是对我有效的使用模式:
// First check
checkPermissions("publish_actions",
// If the required permissions have already been granted
// call the desired method
photoUpload,
// else
function () {
// Asks for permission
FB.login(function () {
// double check - the usar may have skiped the permission again
checkPermissions("publish_actions",
// if the user granted the permission, call the desired method
photoUpload,
// else cancel everything and warn the user
function () {
alert("Can't post without permissions");
});
}, {scope: "publish_actions"});
});
// First check
checkPermissions("publish_actions",
// If the required permissions have already been granted
// call the desired method
photoUpload,
// else
function () {
// Asks for permission
FB.login(function () {
// double check - the usar may have skiped the permission again
checkPermissions("publish_actions",
// if the user granted the permission, call the desired method
photoUpload,
// else cancel everything and warn the user
function () {
alert("Can't post without permissions");
});
}, {scope: "publish_actions"});
});