Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not differentiate between first and lastname #4

Closed
ealvarezdetoledo opened this issue Nov 26, 2020 · 5 comments
Closed

Does not differentiate between first and lastname #4

ealvarezdetoledo opened this issue Nov 26, 2020 · 5 comments

Comments

@ealvarezdetoledo
Copy link

Expected behavior:
When new user is registered, its First and Last name are properly written in the TI database.

Actual behavior:
Full name is stored as First name

Reproduce steps:

Version:
Latest (~3.0)

Additional Information:
(Additional information, if any)

@ealvarezdetoledo
Copy link
Author

Issue seems to be in line 89 of /models/Provider.php

Should be adjusted by:

case 'facebook':
$first_name = $providerUser->offsetGet('first_name');
$last_name = $providerUser->offsetGet('last_name');
break;

case 'google':
$first_name = $providerUser->offsetGet('given_name');
$last_name = $providerUser->offsetGet('family_name');
break;

@ealvarezdetoledo
Copy link
Author

So apparently the problem is that, as coded, the driver will no return these fields, thus you need to specify which fields you want FB to resturn:

//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();

@BreakSecurity
Copy link
Contributor

@ealvarezdetoledo Can you make a PR? Whit the fixes

@sampoyigi
Copy link
Member

This issue looks fixed. Closing, but please reopen if it still occurs.

@antoniozh
Copy link

It seems to me that the case is not fixed yet, since only the name field is filled for user. #8 fixes last name issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants