Laravel 5 gets advanced user information from facebook login

I am already setting up a login using facebook using socialite on my laravel 5 website but I just get basic user data such as name and email address how can I get the user's location (country, city) and birthday?

at the moment I have this in my controller to retrieve user data

class UserRepository { public function findByUsernameOrCreate($userData) { return User::firstOrCreate([ 'name' => $userData->name, 'email'=> $userData->email ]); } } 
+5
source share
1 answer

you just need to specify areas and fields before redirecting

 Socialite::driver('facebook')->fields([ 'first_name', 'last_name', 'email', 'gender', 'birthday' ])->scopes([ 'email', 'user_birthday' ])->redirect(); 

:)

0
source

Source: https://habr.com/ru/post/1214884/


All Articles