facebook-cf-sdk icon indicating copy to clipboard operation
facebook-cf-sdk copied to clipboard

facebookGraphAPI.getObject() no longer returns email

Open fabiobozzo opened this issue 7 years ago • 2 comments

Our website's "Login with Facebook" button stopped working last September.

I noticed that these instructions: userAccessToken = facebookApp.getUserAccessToken(); facebookGraphAPI = new FacebookGraphAPI(accessToken=userAccessToken, appId=APP_ID); userObject = facebookGraphAPI.getObject(id=userId); no longer return what we expect.

For example, now we get:

{"name":"Fabio Bozzo","id":"1345145667"}

... while we need (for authentication needs):

{"name":"Fabio Bozzo","id":"1345145667", "email":"[email protected]"}

My API wrapper has not changed over many years. Do you have an idea on what does that depend on? I first thought it was related to 'scope', but that is currently set to 'email' as always. Any changes by Facebook API guys, maybe?

fabiobozzo avatar Dec 04 '17 16:12 fabiobozzo

This looks like as if you need to upgrade your Facebook App endpoint.

Quite a while ago they introduced a more detailed permission model and email might now fall under that.

https://developers.facebook.com/docs/graph-api/overview

You might also have to have a look into which FB API version you're using and if it's deprecated etc.

TheRealAgentK avatar Dec 04 '17 23:12 TheRealAgentK

@fabiobozzo in early releases of the Facebook Graph API they would return a group of fields by default like in v1/v2.0 but now they tend to only send the minimum. So you need specify each field you want.

This will get the email address. userObject = facebookGraphAPI.getObject(id="me", fields="id,name,email");

fingersdancing avatar Dec 05 '17 00:12 fingersdancing