Laravel Socialite without extra packages
Hi,
for my application, I just need to let users login with GitLab oauth2 only. I've already a very simple login page with just one button.
So it's unnecessary for me to use another filament package that provides multiple ways, and Laravel Socialite works fine for me already.
My question:
What would be the best approach to make this work with the filament admin panel? Can I disable or override the login page with my own auth view?
And is there anything to consider when using a "custom" auth approach?
Thank you!
10 Replies
In the config file you can override the Login class, that should work for you π
Look for this:
Thank you! Is there anything else to consider? Except implementing the FilamentUser class (like the docs say).
Not really. Take a look at the existing Login class to see what you need π
I need to open this again:
If I overwrite the login class I get "Invalid route action" and if I return a route like route('login'), the route cannot be found (although it's configured).
What am I missing here?
and: I don't understand what method filament calls in the default class, because you configure the whole class instead of calling a specific method. I guess authenticate() will be called, but that's not working in my class either (same route exception). π€
You don't have to define the route tho
just specify the class in the config
If I just pass the class then I get
Invalid route action: [App\Http\Controllers\Auth\GitLabOAuth2Controller]
hmm
Does the controller need something special? If I
dd
it doesn't even reach the constructor.i can't debug right now
but dont think so
after some testing: It needs to be a livewire component and I copied the original class. It works now, but I didn't fully understand it though π