puneetkay / Facebook-PHP-CodeIgniter

(DEPRECATED) Facebook PHP SDK for CodeIgniter based on Facebook PHP SDK (v.3.2.3)
http://puneetk.com/facebook-php-codeigniter/
79 stars 64 forks source link

After sign in it graph api only returns user name and id and not all the other info such as email, location #14

Closed sandeeppujare closed 7 years ago

sandeeppujare commented 8 years ago

After sign in it graph api only returns user name and id and not all the other info such as email, location etc...am i dong something wrong ?

yeshwanthhooduku commented 8 years ago

Any updates on above mentioned issues

aaryadev commented 8 years ago

If your don't wish to share info those ino will be returned null. After 2015 April there was big change in security which allow user to choose what information they are sharing.

aaryadev commented 8 years ago

Update : ` $user = $this->facebook->getUser(); $user_profile = FALSE; if ($user) { try { $user_profile = $this->facebook->api('/me?fields=name,email'); } catch (FacebookApiException $e) { $user = null; }}

                    if(count($user_profile) == 3){
                        $avatar='https://graph.facebook.com/'.$user_profile['id'].'/picture?type=large';
                        $data=json_encode(array('fb'=>$user_profile));
                        $this->user_model->sign_in($user_profile['email'],$user_profile['name'],$avatar,$data);
                        redirect($this->base_url);
                    }

` Request email extra scope (/me?fields=name,email)

hope this will help you , its working for me . if email not found in response we can show error in view saying , you have denied permission to view email.