Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to ask for more permission after initial authentication in Facebook

Tags:

facebook

I've a facebook app at which I've asked users to give their email, work Info etc. The users have already granted the permission to retrieve these information.

Now I want to retrieve their phone numbers also but I've not asked for it previously.

So how do I ask the already authenticated users to give access to their phone numbers?? Is their some code which I can add and next time they logged in, they are prompted to authenticate that extra info??

like image 662
ptamzz Avatar asked Jan 25 '11 15:01

ptamzz


2 Answers

You can call FB.login again but specify the permissions you want to request for this time with scope. Example below, where you are requesting publish_stream:

FB.login(function(response) {
  if (response.authResponse) {
    // user gave permission        
  } else {
    // user did not give permission
  }
}, {scope:'publish_stream'});

You can also use FB.ui with method set to 'permissions.request'

See http://fbdevwiki.com/wiki/FB.ui#method:_.27permissions.request.27

like image 142
James L. Avatar answered Jan 05 '23 04:01

James L.


You need to send in the "extra" permissions the same way you got the initial ones. When your user hits the URL it will open up the same "permissions" box on FB that they were originally present with, but only with the new requested permissions set. They'll go through the same process of accepting or declining, then they'll come back to your site.

Edit: Make sure you add the same permissions you asked for originally, or FB will remove those original ones.

like image 24
El Guapo Avatar answered Jan 05 '23 03:01

El Guapo