Eugene
Eugene

Reputation: 1

How to get proper permission on facebook to request user email?

here is an example with proper permissions. if I open it in browser I can get access to images and email.

https://graph.facebook.com/oauth/authorize?
    type=user_agent&
    client_id=116122545078207&
    redirect_uri=http%3A%2F%2Fbenbiddington.wordpress.com&
    scope=user_photos,email,user_birthday,user_online_presence 

But when I execute the same url but with my client_id I don't get image, email just birthday information

What is the difference between? How can I get proper permissions to prompt user to provide image and email?

Upvotes: 0

Views: 6605

Answers (2)

Sourav
Sourav

Reputation: 259

i have found a solution use this code it may help you









<html>
<head></head>
<body>
<a href="javascript:void(0)" id="login">Connect My Account With Facebook</a>
<br>
<a href="javascript:void(0)" id="logout">logout Facebook</a>
<br />
<div id='user-info'></div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">

// initialize the library with the API key
FB.init({ apiKey: 'da21de4c85b58a0a510267aca5e17449',appId:'139950472740638'});

// fetch the status on load
FB.getLoginStatus(handleSessionResponse);

$('#login').bind('click', function(){FB.login(handleSessionResponse);});

$('#logout').bind('click', function() {FB.logout(handleSessionResponse);});

$('#disconnect').bind('click', function() {
FB.api({ method: 'Auth.revokeAuthorization' }, function(response) {
clearDisplay();
});
});



// handle a session response from any of the auth related calls
function handleSessionResponse(response)
{
// if we dont have a session, just hide the user info
if (!response.session) {clearDisplay(); return;}

FB.ui({
method: 'permissions.request',
perms: 'email'
},
function (response)
{
FB.api({
method: 'fql.query',
query: 'SELECT name,email,uid FROM user WHERE uid=' + FB.getSession().uid
},
function(response2)
{
var user = response2[0];
$('#user-info').html(user.name +' -- '+ user.email +' -- '+ user.uid).show('fast');
}
);
}

);

}
</script>

</body>
</html>

Upvotes: 0

Awais Qarni
Awais Qarni

Reputation: 18016

<fb:login-button perms='email, user_photos, user_birthday, user_online_presence' autologoutlink='true'></fb:login-button>

After Edit

You can read more information about Graph API From here.

Again Edit. You can find here some live example of C# SDK

Upvotes: 5

Related Questions