Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Novum's avatar
Level 1

Laravel Google OAuth Gender etc

Hey, I'm currently trying to integrate Google Authentication into my Laravel Application. I nearly managed to get everything working but still struggle with one aspect. I'm trying to fetch the gender, birthday and phone number, and the user also gets asked for the correct permissions, but I'm not receiving the fields after the callback comes back successful

Down below you can see the code with which I'm trying to fetch the right scopes. It's working perfectly fine for Facebook but for Google, as said, I'm still not receiving the fields. Does anyone know how to get it working? I found many tutorials but they never used scopes and sometimes also the old Google-API which makes it quite hard for me to figure it out myself. Thank you very much in advance! :)

case 'facebook':
                return Socialite::driver($provider)
                    // facebook
                    ->fields([
                        'first_name', 'last_name', 'email', 'gender', 'birthday', 'location'
                    ])->scopes([
                        'email', 'user_birthday', 'user_gender, user_location'
                    ])->redirect();
            case 'google':
                return Socialite::driver($provider)
                    ->scopes([
                        'openid',
                        'profile',
                        'email',
                        [... Im not allowed to use links yet see below ...]

                    ])
                    ->stateless()
                    ->redirect();

As I'm not allowed to use links yet the following links should be in the intended block googleapis.com/auth/user.gender.read' googleapis.com/auth/user.birthday.read', googleapis.com/auth/user.addresses.read', googleapis.com/auth/user.phonenumbers.read',

0 likes
3 replies
Novum's avatar
Level 1

@martinbean Thank you for your answer. Can you also tell me where I need to request the scopes? Additionally when I tried it back then and now with just the string(without the url) I'm getting the error 400: invalid_scope from Google.

Please or to participate in this conversation.