Problems with canAccessPanel what is the filament.app.tenant route?
Really struggling with multiple panels in my app. I have 2 internal panels, app and admin, and one external panel, client. An internal user can login just fine, but having all kinds of problems getting the user logged in on the client panel.
when the user logs in, I either get the credentials don't match error (see screenshot), or I get a 403, and the route that is giving the 403 is
when the user logs in, I either get the credentials don't match error (see screenshot), or I get a 403, and the route that is giving the 403 is
filament.app.tenant
which is not in the route list and I have no idea what it is.
i'm pretty sure the problem is my canAccessPanel method, but I'm unsure of what I should even be doing. The panel is "app" when it gets to this method, but the panel should be "client", so how and where do I make sure that's happening? Do I set the panel to the correct one from the canAccessPanel method?Solution:Jump to solution
Once I figured that out, it seems I just need to tweak my getDefaultTenant() method on my User model to return an empty model in the event that the user isn't internal, which then causes the redirect controller to return the panel url instead of trying to redirect to the tenant registration page.
```php
public function getDefaultTenant(Panel $panel): ?Model
{...
2 Replies
If I change the panel based on the current user attempting to login:
I get a 404 error, and it's going to the
filament.app.tenant
route. Really confused.
from debug bar I found that the location where it's ultimately failing is in the RedirectToTenantController:
This panel doesn't have tenancy, so the tenant is empty for this user. I'm realizing that's likely the root cause of this issue, but I don't know how to fix it. I I don't have any tenancy features enabled on my panel.
I tried to add this in my Authentication middleware:
ok, stupid on my part, but i didn't realize that setCurrentPanel doesn't return the panel after setting it, so that part is working, but I'm still getting a 404 error after this point somewhere.Solution
Once I figured that out, it seems I just need to tweak my getDefaultTenant() method on my User model to return an empty model in the event that the user isn't internal, which then causes the redirect controller to return the panel url instead of trying to redirect to the tenant registration page.