开发者

how to ask for more permission after initial authentication in 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, t开发者_StackOverflow社区hey are prompted to authenticate that extra info??


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜