Solved

Facebook Javascript Verify and Request Permissions

Posted on 2013-05-13
2
707 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 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

728 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