Role based access control using fortify or multiple authentication system using fortify
How to add multiple authentications using fortify?. like, if we have admin, registered user and public user, we have to implement different auth for admin and registered user. Jetstream comes with authentication by default. But how to add a different one using fortify?
I think I want to achieve this in another way. I have two users (actually 3. but one is the public user. not part of any authentication) Admin and authenticated user say, author.
Author login URL will be website.com/login (provided by jetstream or fortify).
Admin login will be website.com/admin/login.
Both users have a different endpoint for login. On earlier versions, we can create these endpoints by copy-pasting the auth provided by laravel. I want to achieve the same using fortify. Is that possible?
You are not required to use the authentication scaffolding included with Laravel Jetstream. If you choose to not use this scaffolding, you will need to manage user authentication using the Laravel authentication classes directly. Don't worry, it's a cinch!
We will access Laravel's authentication services via the Auth facade, so we'll need to make sure to import the Auth facade at the top of the class. Next, let's check out the attempt method:
You may want to re-study this chapter in the new laravel 8, then decide how you want to proceed.
But even with out of the box auth you can still have 2 endpoints. But it would be using same table.
That is how, the ability to "redirect" depending on role.
When I saw it missing from Laravel 8 I created an issue right away. See the LoginResponse class @snapey wrote, so You could probably "extend" other classes as well.