Is it possible to use Laravel authentication for the central domain and the tenants? So far, in the documentation I find that I can use universal routes to be able to use Auth::routes() in the central domains and in the tenants, although I don't have a clear idea of how I should do it (if I should create the universal route only in web.php or it also has to be in tenant.php). And my big question is if this will work to be able to log in to my central domain and the tenants.
I tried to add auth::routes() in web.php and in tenant.php but only the login worked in the tenant and in the central domain I received 404 not found. But with universal routes I don't find a solution either, because I don't understand how I should do it either.
Yes, it's possible to use Laravel authentication for both the central domain and the tenants. You can utilize universal routes to achieve this. However, it's essential to understand how to configure these routes properly.
However, ensure that you have configured your system to differentiate between central domain routes and tenant routes correctly. Otherwise, you may encounter 404 errors.
Declaring the auth route twice will indeed lead to conflicts. Before proceeding further, it's crucial to understand the intended functionality of your application. Do users need to be able to log in from both the central domain and the tenants?
If the primary login functionality is intended for the central domain, then it makes more sense to define the authentication routes only there (
web.php). Upon logging in, you can then redirect the user to the appropriate tenant based on their credentials.This approach simplifies the authentication process and avoids potential conflicts between routes. It also ensures a clear separation of concerns, with the central domain handling authentication and redirection logic, while the tenants focus on their specific functionalities.