SocialiteProviders / Providers

A Collection of Providers for Laravel Socialite
https://socialiteproviders.com
MIT License
487 stars 435 forks source link

Make TikTok username optional based on scopes set #1183

Closed Skullbock closed 2 months ago

Skullbock commented 3 months ago

In v2, username can be requested only if user.info.profile scope is set. Instead of forcing the scope, since it's not even in the default list of scopes set in the provider, we could just add the username field if the scope is present.

Closes #1198

liamseys commented 3 weeks ago

I got approved and added this scope, but I still can't see the username.

liamseys commented 3 weeks ago

@atymic I debugged this: the username field isn't being passed to the fields list when the scope was added. Was this tested before merging?

atymic commented 3 weeks ago

@liamseys can you share the scopes you're using in laravel?

liamseys commented 3 weeks ago

@atymic

return Socialite::driver('tiktok')
            ->scopes(['user.info.basic', 'user.info.profile'])
            ->redirect();
liamseys commented 3 weeks ago
Scherm­afbeelding 2024-06-12 om 16 13 49
liamseys commented 3 weeks ago
array:1 [▼ // vendor/socialiteproviders/tiktok/Provider.php:107
  0 => "user.info.basic"
]

When I print $this->scopes in the Provider.php file, I only see user.info.basic, even though I set more in the scopes method.

atymic commented 3 weeks ago

It should merge them correctly Screen Shot 2024-06-13 at 08 38 25

Can you show your whole controller? Do you set the scopes also when you call ->user();