-
Notifications
You must be signed in to change notification settings - Fork 36
Graph Api 2.4 ('/me') returns name and id only #41
Comments
@flexroad you probably have to ask for the permissions in the app settings in developer console in facebook. |
If it's a bug of this extension, please reopen. |
As I said... When I use different facebook app (v 2.2) (I have changed appId and 51a76f436572195b41550af7a21fb84d) all works perfectly. I looks like some incompatibility between current kdyby/facebook and facebook graph api v2.4. |
Kdyby is not changing any responses, it just returns what it gets from the api |
I have very little time to investigate this right now. Can you debug it please? |
I have no idea how to do that. :( Any article about "debug it please"? Cheers. |
I think that Kdyby\Facebook\Facebook::api behaves correctly. If you want email in v2.4, you should call: $fb->api('/me', NULL, ['fields' => 'email']); But there is problem with Kdyby\Facebook\Profile::getDetails that does not return required field. Temporary fix could be, for example: public function getDetails($key = NULL)
{
if ($this->details === NULL) {
try {
$this->details = $this->facebook->api('/' . $this->profileId);
} catch (FacebookApiException $e) {
$this->details = array();
}
}
if ($key !== NULL) {
if (!array_key_exists($key, $this->details)) {
try {
$fields = $this->facebook->api('/' . $this->profileId, NULL, ['fields' => $key]);
$this->details[$key] = isset($fields[$key]) ? $fields[$key] : NULL;
} catch (FacebookApiException $e) {
$this->details[$key] = NULL;
}
}
return isset($this->details[$key]) ? $this->details[$key] : NULL;
}
return $this->details;
} |
see Declarative Fields @ https://developers.facebook.com/docs/apps/changelog#v2_4 |
@davidkrmela your example didn't work for me. For me, only little modification in request call helped: $me = $fb->api('/me?fields=id,first_name,last_name,picture,email'); I have to specify requested fields right after /me string and everything works fine. Statement with fields specified as 3rd param of ->api method didn't work for me. |
@JakubTN that's strange. On master, I just tried: $me = $fb->api('/me', NULL, ['fields' => [
'id',
'first_name',
'last_name',
'picture',
'email',
]]); and gives me same result. |
@davidkrmela I'm using 2.0.0., maybe that's the reason. |
Since v2.4 , the graph API requires that you explicitly request the field(s) you need for your GET requests. |
Now Im not getting the email For iOS, i have it this way:
I am already putting 'email' in the fields. |
One of the my friend was trying to the issue from last 5 days. huummm very irritating. which got love in 2 min... Assumption: using PHP for O2Authentication
And job is done. Thanks & Regards |
Came here because had same problem with Javascript SDK, unrelated to Nette project, and your inputs guys helped me, indeed had to pass ?fields explicitely in |
thanks man |
I have setup new Facebook app and it is under the api version 2.4. When I call
php $fb->api('/me');
it returns name and id only... What I need is email as well. Any ideas?All works perfectly with 2.0 and 2.2 (other fb apps I'm using)
The text was updated successfully, but these errors were encountered: