I have a facebook app installed and working great. What I would like to do is add in the functionality of requesting user permission data. such as - read_friendlists,user_groups,email,user_birthday,status_update,publish_stream,
Firstly here is the code that checks if a fan or none fan is on our facebook timeline app.
// If a fan is on your page
if ($like_status) {
$a = file_get_contents("http://www.domain.com/home.php");
echo ($a);
}
else {
// If a non-fan is on your page
$a = file_get_contents("http://www.domain.com/home.php");
echo ($a);
}
What I would like to do, is, if a none fan is on our page, open a facebook request for permission and set a number of permissions. Then redirect them to the // if a fan is on our page.
I have had a good look around here but I am still not clear how to setup the "request" for permission page. Any help would be greatly appreciated
you can do this in two ways..
1) Open oauth dialog in page by setting the url
var oauth_url = 'https://www.facebook.com/dialog/oauth/';
oauth_url += '?scope=email,user_birthday,user_location,user_about_me,user_likes';
oauth_url += '&client_id=' + appid;
oauth_url += '&redirect_uri=' + encodeURIComponent('https://www.facebook.com/pages/' + appname + '/' + pageId + '/?sk=app_' + appid);
window.top.location = oauth_url;
2) Or you can open the oauth dialog in popup:
FB.login(function(loginResponse) {
if (loginResponse.authResponse) {
var userId = loginResponse.authResponse.userID;
}
else {
//'User cancelled login or did not fully authorize.
}
}, { scope: 'email,user_birthday,user_location' });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With