I just started using laravel, I am using laravel socialite.
I am able to get username and other data by using following code. But how do I get other data like birthd
It worked for me too. Please note its issue at socialite2.0 for laravel 5.2 Just download and update the code. https://github.com/laravel/socialite/blob/2.0/src/Two/FacebookProvider.php
In socialite redirect to facebook method :
public function redirectToFacebook()
{
return Socialite::driver('facebook')->fields([
'first_name', 'last_name', 'email', 'gender', 'birthday'
])->scopes([
'email', 'user_birthday'
])->redirect();
}
To get the birth date.
Then to use it in your own models :
public function handleFacebookCallback()
{
$facebook_user = Socialite::driver('facebook')->fields([
'first_name', 'last_name', 'email', 'gender', 'birthday'
])->user();
}
Note: it will ask for the user to accept sharing their birth date when they connect to Facebook though.