Facebook App: Where do i put offline_access request?
I need my app to request the offline_access permission (detailed here), but as ever I'm baffled by the Facebook documentations.
It says I need a comma separated list of my permission demands, like 'publish_s开发者_开发问答tream,offline_access'
etc
where do i put this list in the interface below????
It's used with the API, as follows
$facebook = new Facebook(array(
'appId' => FACEBOOK_APP_ID,
'secret' => FACEBOOK_SECRET,
'cookie' => false,
));
$facebook_login_url = $facebook->getLoginUrl(array(
'next' => '',
'cancel_url' => '',
'req_perms' => 'email,publish_stream,status_update'
));
Where $facebook_login_url
is the URL tha the user needs to follow to grant you access.
Does that help?
You can't do this with that interface. You need to set scope
parameter when redirecting user to facebook.
x=y&scope=email,user_about_me,user_birthday,user_photos,publish_stream,offline_access
First define which permissions you will need:
$par['req_perms'] = "friends_about_me,friends_education_history,friends_likes,friends_interests,friends_location,friends_religion_politics,
friends_work_history,publish_stream,friends_activities,friends_events,
friends_hometown,friends_location,user_interests,user_likes,user_events,
user_about_me,user_status,user_work_history,read_requests,read_stream,offline_access,user_religion_politics,email,user_groups";
$loginUrl = $facebook->getLoginUrl($par);
Then, check if the user has already subscribed to app:
$session = $facebook->getSession();
if ( is_null($session) ) {
// no he is not
//send him to permissions page
header( "Location: $loginUrl" );
}
else {
//yes, he is already subscribed, or subscribed just now
echo "<p>everything is ok";
// write your code here
}
精彩评论