mingfish_004
mingfish_004

Reputation: 1413

how to request user permissions using facebook api in js?

how to request user permissions using facebook api in js? I want to let people login my site using facebook login. then I want to request facebook datas from the visitor. now I can get datas like this using js

FB.api('/100005658545226?fields=id,name,email') =>

{
    "id": "100005658545226",
    "name": "Mingfish Lin"
}

but there is no email info in the response json, so I want to send a request to ask user to authorize this email permission . how can I do this job in js? such as what does bellow. enter image description hereenter image description hereenter image description hereenter image description here

Upvotes: 1

Views: 806

Answers (1)

Michael Leaney
Michael Leaney

Reputation: 751

Call the login method with a callback and an options object with an array as the scope property, such as:

FB.login(callback, {scope: ['email']});

More info at Facebook Permissions

Upvotes: 3

Related Questions