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

Fix some bugs from testing Google Oauth #871

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

hufman
Copy link

@hufman hufman commented Dec 16, 2024

Thank you very much for implementing #174, I'm happy to test!
Google objected to the redirect_uri having curly braces, so I updated it to match the other providers' patterns.
Google also doesn't provide a nickname (a known limitation), so I set it to use the email as a fallback.

@Kovah
Copy link
Owner

Kovah commented Dec 17, 2024

Will have a look as soon as I have the time.

Copy link
Owner

@Kovah Kovah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. I have

$userData = [
  'name' => $socialUser->getNickname() ?: $socialUser->getName(),
];

in another app that supports login with Google and I get the original user names there. According to the documentation of the library used for this, Google should provide the user name.

Could this be a configuration issue in the Google SSO options?

@hufman
Copy link
Author

hufman commented Dec 19, 2024

Good morning!
I haven't found any extra scopes to add or reconfigure in the Google Cloud Console that would provide this nickname/username field. I do prefer how the titlebar looks when I set my instance to fallback to getName instead of getEmail, though!
I logged what the User object looks like, does your other app include a nickname value?

NOTICE: PHP message: Laravel\Socialite\Two\User Object
(
    [id] => 10189...
    [nickname] =>
    [name] => Walter Huf
    [email] => [email protected]
    [avatar] => https://lh3.googleusercontent.com/a/ACg8ocK5Fzesz6LI7IoHoE9WjthvMSBvwn1Y0aorPNkwWpuClIhq00d-=s96-c
    [user] => Array
        (
            [sub] => 10189...
            [name] => Walter Huf
            [given_name] => Walter
            [family_name] => Huf
            [picture] => https://lh3.googleusercontent.com/a/ACg8ocK5Fzesz6LI7IoHoE9WjthvMSBvwn1Y0aorPNkwWpuClIhq00d-=s96-c
            [email] => [email protected]
            [email_verified] => 1
            [id] => 10189...
            [verified_email] => 1
            [link] =>
        )
    [attributes] => Array
        (
            [id] => 101891414244860584693
            [nickname] =>
            [name] => Walter Huf
            [email] => [email protected]
            [avatar] => https://lh3.googleusercontent.com/a/ACg8ocK5Fzesz6LI7IoHoE9WjthvMSBvwn1Y0aorPNkwWpuClIhq00d-=s96-c
            [avatar_original] => https://lh3.googleusercontent.com/a/ACg8ocK5Fzesz6LI7IoHoE9WjthvMSBvwn1Y0aorPNkwWpuClIhq00d-=s96-c
        )
    [token] => ya29.a0ARW...
    [refreshToken] =>
    [expiresIn] => 3598
    [approvedScopes] => Array
        (
            [0] => openid
            [1] => https://www.googleapis.com/auth/userinfo.profile
            [2] => https://www.googleapis.com/auth/userinfo.email
        )
)

@Kovah
Copy link
Owner

Kovah commented Dec 19, 2024

Alright, I'll update the code right away, but you might keep your configuration change.

Kovah added a commit that referenced this pull request Dec 19, 2024
@hufman
Copy link
Author

hufman commented Dec 19, 2024

Thank you very much!

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

Successfully merging this pull request may close these issues.

2 participants