mikebronner / laravel-sign-in-with-apple

Provide "Sign In With Apple" functionality to your Laravel app.
MIT License
451 stars 67 forks source link

Name and Surname #46

Open markonikolicdir opened 2 years ago

markonikolicdir commented 2 years ago

Hello,

I am using this lib and it is working very good but missing data about user when user logging from mobile app.

I saw in method mapUserToObject that you are taking from the request firstName and lastName.

Is only solution for this to grab it from mobile app?

In Apple doc I didn't find firstName or lastName.

https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple

kitro commented 2 years ago

The same issue I have when I try to get the name from the user object.

$user = Socialite::driver("sign-in-with-apple")->user();
dd($user->getName()); // is empty
mikebronner commented 2 years ago

i belive you have to add the scopes, which is mentioned on the readme. Did this not work?

Socialite::driver("sign-in-with-apple")
            ->scopes(["name", "email"])
            // ...
kitro commented 2 years ago

i belive you have to add the scopes, which is mentioned on the readme. Did this not work?

Socialite::driver("sign-in-with-apple")
            ->scopes(["name", "email"])
            // ...

Thank you for your reply, I tested with and without the scopes when I try to get the name is always null.

mikebronner commented 2 years ago

hmmm, that is odd ... I will have to test this again.

somarkn99 commented 2 years ago

I have the same issue when I use it like this: Socialite::driver('sign-in-with-apple')->userFromToken($data['access_token']);

kitro commented 2 years ago

This the user objected returned, I submitted the request with the scopes name and email. image

momar3632 commented 1 year ago

I have the same issue when I use it like this: Socialite::driver('sign-in-with-apple')->userFromToken($data['access_token']);

d-spaczynski commented 1 year ago

Similar problem, Im getting name/email as nulls, even after I clear the app from my apple account, so it is the first time login ever. Im retrieving user data with: $user = Socialite::driver("sign-in-with-apple")->user();

Anyone managed to get those data?