DutchCodingCompany / filament-socialite

Add OAuth login through Laravel Socialite to Filament.
MIT License
141 stars 36 forks source link

Allow existing user to register socialite user #75

Closed lordalisat closed 4 months ago

lordalisat commented 5 months ago

Allow existing users to register a Socialite user, without there being the possibility of registering new users.

Sometimes, you may want to enable users to link their user account, without being able to create new user accounts. A variable (socialiteRegistrationEnabled) can be used to enable this behaviour. The functionality for registrationEnabled stays the same.

bert-w commented 4 months ago

I modified the code in a new PR to apply generally to any registration. You can modify the callback now to use an Authenticatable $user parameter:

->setRegistrationEnabled(fn (string $provider, SocialiteUserContract $oauthUser, ?Authenticatable $user) => (bool) $user)

See https://github.com/DutchCodingCompany/filament-socialite/pull/80 for the new implementation. It should be available in the next release.