Reputation: 65
How can I get first name and last name from Facebook using Laravel Socialite? By default I'm getting full name in a single field.
Upvotes: 2
Views: 2377
Reputation: 41
You can get field from provider like this.
//get the driver and set desired fields
$driver = Socialite::driver('facebook')
->fields(['name', 'first_name', 'last_name', 'email', 'gender', 'verified']);
// retrieve the user
$user = $driver->user();
follow this link for more details
Laravel Socialite first and last name
Upvotes: 0
Reputation: 65
Socialite::driver('facebook')->fields(['first_name', 'last_name'])->user();
Upvotes: 3