jeudi 30 juin 2016

Laravel 5.2 Socialite Retrieve Null Email

i'm new to Laravel and i'm trying to make a social auth. I have seen some tutorials and I've got to retrieve user id, profile pic and name from Facebook. My problem is the email, it comes null.

My current object is this:

User {#195 ▼
  +token: "EAACYY1xBrzcBAO9KZAjZAZAZBQHWhbtZAb9lIXvH9Y6miRUiABImupk3ZCzHRxy2ZBxc9DU8f1ZAcrw0NEVMmy3GOQMSSyrmDTvMPyREvGm4pA1Ok6zI85LxES4Huy2ZCsxIUr2ISbLreLIv1ZACItUUoqqAnvVPyR4s0ZD"
  +id: "989087311199546"
  +nickname: null
  +name: "MyName"
  +email: null
  +avatar: "http://ift.tt/296NWa7"
  +"user": array:2 [▼
    "name" => "MyName"
    "id" => "MyId"
  ]
}

and my controller is:

class FacebookController extends Controller
{
   public function facebook()
    {
        return Socialite::driver('facebook')
            ->scopes(['email'])->redirect();
    }
    public function callback()
    {
        $user = Socialite::with('facebook')->user();

        return dd($user);
        // $user->token;
    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire