Solved

Facebook Javascript Verify and Request Permissions

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now