Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ThomasJ's avatar

Socialite Facebook, user's email is always null

Hi everyone, First, I hope you'll understand everything because i'm French. I use Laravel since weeks now, and i'm trying to use Socialite. I've followed Documentation, and found help on Laracasts, especially here : https://laracasts.com/discuss/channels/laravel/socialite-facebook-extra-fields

My problem is that, I've exactly the same code as the person on this topic (to be sure I didn't made any keyboard mistake) but facebook's response is always the same : $user's email is null (For exemple, i receive his birthday, added in scopes)

Here is the code :

In AuthController.php /

public function facebookConnect($provider)
{
    return Socialite::driver($provider)->fields([
        'first_name', 'last_name', 'email', 'gender', 'birthday'
    ])->scopes([
        'email', 'user_birthday'
    ])->redirect();

}

And just after facebookConnect, still in AuthController.php /

public function facebookCallback($provider)
{
 //notice we are not doing any validation, you should do it

    $user = Socialite::driver('facebook')->fields([
        'first_name', 'last_name', 'email', 'gender', 'birthday'
    ])->user();
    // stroing data to our use table and logging them in
    $data = [
        'name' => $user->getName(),
        'first_name' => $user->getName(),
        'email' => $user->getEmail()
    ];


    //after login redirecting to home page
    dd($user);
    return View('social.confirmFacebook')->with('name',$data['name']);
}

And this is my dd($user) :

User {#175 ▼ +token: "..." +id: "..." +nickname: null +name: "Thomas J..." +email: null +avatar: "https://graph.facebook.com/v2.4/102...." +"user": array:5 [▼ "first_name" => "Thomas" "last_name" => "J..." "gender" => "male" "birthday" => "12/....." "id" => "..." ] +"avatar_original": "https://graph.facebook.com/v2.4/102...." }

It's probably something stupid... But i can't figure out it... Hope you understood everything, and thank's for your precious help ! :)

0 likes
2 replies
Frozire's avatar

For people who run into the same problem, this is the expected behavior.

You can register on Facebook without an email; the logic becomes that you either have an email or a mobile number.

2 likes

Please or to participate in this conversation.