Permalink
Browse files

[Facebook] Adding birthday field to be retrieved

  • Loading branch information...
1 parent e7a0834 commit 71531f2db6765963502edd9c7223612d4300ea0d @StorytellerCZ StorytellerCZ committed Aug 31, 2015
Showing with 10 additions and 9 deletions.
  1. +10 −9 hybridauth/Hybrid/Providers/Facebook.php
@@ -8,9 +8,9 @@
/**
* Hybrid_Providers_Facebook provider adapter based on OAuth2 protocol
- *
+ *
* Hybrid_Providers_Facebook use the Facebook PHP SDK created by Facebook
- *
+ *
* http://hybridauth.sourceforge.net/userguide/IDProvider_info_Facebook.html
*/
class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
@@ -23,7 +23,7 @@ class Hybrid_Providers_Facebook extends Hybrid_Provider_Model {
/**
* Provider API client
- * @var Facebook
+ * @var Facebook
*/
public $api;
@@ -91,7 +91,7 @@ function loginBegin() {
Hybrid_Auth::storage()->set('fb_auth_nonce', $parameters['auth_nonce']);
}
- // get the login url
+ // get the login url
$url = $this->api->getLoginUrl($parameters);
// redirect to facebook
@@ -136,15 +136,15 @@ function loginFinish() {
}
}
- // try to get the UID of the connected user from fb, should be > 0
+ // try to get the UID of the connected user from fb, should be > 0
if (!$this->api->getUser()) {
throw new Exception("Authentication failed! {$this->providerId} returned an invalid user id.", 5);
}
// set user as logged in
$this->setUserConnected();
- // store facebook access token
+ // store facebook access token
$this->token("access_token", $this->api->getAccessToken());
}
@@ -163,8 +163,9 @@ function getUserProfile() {
// request user profile from fb api
try {
$fields = array(
- 'id', 'name', 'first_name', 'last_name', 'link', 'website',
- 'gender', 'locale', 'about', 'email', 'hometown', 'location'
+ 'id', 'name', 'first_name', 'last_name', 'link', 'website',
+ 'gender', 'locale', 'about', 'email', 'hometown', 'location',
+ 'birthday'
);
$data = $this->api->api('/me?fields=' . implode(',', $fields));
@@ -427,4 +428,4 @@ function getUserActivity($stream) {
return $activities;
}
-}
+}

1 comment on commit 71531f2

@kumardippu

But Twitter is not returning basic information like gender,age etch . can anyone tell me how can I get ?
Below are the codes ->
/path/auth/hybridauth/Hybrid/Providers/Twitter.php

function getUserProfile() {
    $includeEmail = isset($this->config['includeEmail']) ? (bool) $this->config['includeEmail'] : false;
    $response = $this->api->get('account/verify_credentials.json'. ($includeEmail ? '?include_email=true' : ''));
    //$response = $this->api->get('account/verify_credentials.json');
    print_r($response);exit;
Please sign in to comment.