simpleJack
simpleJack

Reputation: 344

Facebook app not showing updated permission

I have created a facebook app with following permissions: emailuser_birthday user_education_history user_hometownuser_likes friends_birthday friends_education_history friends_hometown friends_likes

And when I click preview login dialog, I see: all the permissions

But when I use to access the app through my Javascript code,

<html>
<body>
<div id="fb-root"></div>
<script>
 // Additional JS functions here

window.fbAsyncInit = function() {
FB.init({
  appId      : '483353595041064', // App ID
  channelUrl : 'channel.html', // Channel File
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
 });

// Additional init code here
FB.getLoginStatus(function(response) {
  if (response.status === 'connected') {
    alert("Welcome");
  } else if (response.status === 'not_authorized') {
    login();
  } else {
    // not_logged_in
  }
 });


 };

 function login() {
FB.login(function(response) {
    if (response.authResponse) {
        // connected
        testAPI();
    } else {
        // cancelled
    }
});
}

 function testAPI() {
  console.log('Welcome!  Fetching your information.... ');
  FB.api('/me', function(response) {
    console.log('Good to see you, ' + response.name + '.');
  });
 }
// Load the SDK Asynchronously
 (function(d){
 var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
 if (d.getElementById(id)) {return;}
 js = d.createElement('script'); js.id = id; js.async = true;
 js.src = "//connect.facebook.net/en_US/all.js";
 ref.parentNode.insertBefore(js, ref);
 }(document));
</script>
</body>
</html>

I can see only basic info under permission:

Why do the permissions in preview box do not reflect in actual login box?

Upvotes: 1

Views: 538

Answers (1)

Sahil Mittal
Sahil Mittal

Reputation: 20753

This is because you didn't set the permissions while login (in your code). Try this-

FB.login(function(response) {
  if (response.authResponse) {
      // connected
      testAPI();
  } else {
      // cancelled
  }
},{scope:'email, etc...'});

Upvotes: 1

Related Questions