Search code examples
phpfacebooklaravellaravel-socialite

Laravel Socialite - get date of birth and email while loging in with facebook


This is in my routes

Route::get('auth/facebook', 'Front@redirectToProvider');

Front.php

public function redirectToProvider()
{
  return Socialite::driver('facebook')->redirect();
}

But in permission window i don't see permission for phone number . how to add that perission?

enter image description here

enter image description here

Laravel Framework version 5.2.45

Update: It seems i can't get the phone number but it seems i can get date of birth .My idea was that if i know how to get phone then i can use the same code to get other fields too like email and date of birth . What do i need to add and where to get these fields?


Solution

  • It is not possible to get the phone number of a Facebook User. There is not even a field for it in the user table: https://developers.facebook.com/docs/graph-api/reference/user

    About birthday and other fields, see this thread: How to get birthday gender and religion information using laravel socialite implementing facebook Api