Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Facebook Javascript Verify and Request Permissions

Posted on 2013-05-13
2
Medium Priority
?
720 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

636 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