Solved

Facebook Javascript Verify and Request Permissions

Posted on 2013-05-13
2
695 Views
Last Modified: 2013-05-14
Hi E's, I am a beginner in Facebook Developers using Javascript or other language:
I have this code, that I copy from the examples of FB developers site:
<html>
<head></head>
<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
  FB.init({
    appId      : '463164587035065', // App ID
    channelUrl : 'www.wwdablio.org', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });
  
  FB.Event.subscribe('auth.authResponseChange', function(response) { 
    if (response.status === 'connected') {
      testAPI();
    } else if (response.status === 'not_authorized') {
      FB.login();
    } else {
      FB.login();
    }
  });
  };

  // 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));

  function testAPI() {      
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Good to see you, ' + response.name + '.');
    });
  }
  
</script>
<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
</body>
</html>

Open in new window

What the above code do, is verify if the user is login in FB, if not, the user have the opportunity to make login.
The problem is by default the API just give the basic permission, and I want try more kind of permissions, like "user_birthday" and "user_location".
I just need to know, and using the code above, where I can request the permissions "user_birthday" and "user_location", and how?

The best regards, JC
0
Comment
Question by:Pedro Chagas
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39163568
Go here : https://developers.facebook.com/docs/reference/plugins/login/
Attributes section :
scope - a comma separated list of extended permissions. By default the Login button prompts users for their public information. If your application needs to access other parts of the user's profile that may be private, your application can request extended permissions. A complete list of extended permissions can be found here.

Permissions : https://developers.facebook.com/docs/reference/login/#permissions

Extended Profile Properties
- user_birthday
- user_location

<fb:login-button show-faces="true" width="200" max-rows="1" scope="user_birthday,user_location"></fb:login-button>

Open in new window

0
 
LVL 3

Author Closing Comment

by:Pedro Chagas
ID: 39165537
The grade for this question is A++.
Thank you

~JC
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question