-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constructor throws User doesn't have the right permissions
but login via passport works okay.
#2554
Comments
maybe wrong guard |
Yes, I'd be checking what guard the user is connected with. Also, as a troubleshooting tool you could enable the detailed output of the exception, via the config file: laravel-permission/config/permission.php Lines 132 to 138 in c66c0de
|
Dear Chris
Thank you for your quick response. Here I'm attaching an image "auth
config in laravel". You can see it and give me your feedback.
Thanks
Regards
…On Tue, Nov 14, 2023 at 3:13 AM Chris Brown ***@***.***> wrote:
Yes, I'd be checking what guard the user is connected with.
Also, as a troubleshooting tool you could enable the detailed output of
the exception, via the config file:
https://github.com/spatie/laravel-permission/blob/c66c0de99a95a88288507fa96676b89625f54488/config/permission.php#L132-L138C17
—
Reply to this email directly, view it on GitHub
<#2554 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJZ5EBILHP3POAWX6RRLTATYELASFAVCNFSM6AAAAAA7JDUZ3SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBZGM4DINJVGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
i'am using gurad like below
my route middleware is auth:api like below:
|
https://spatie.be/docs/laravel-permission/v6/basic-usage/middleware#content-middleware-via-routes |
i don't need use permission middleware in route. i want to use it in constructor controller. |
It seems like you're very lost, that's what I wrote.
|
iam using api routes so, middleware shoud be auth:api. all permissions are loaded with user response but while using these permissions in controller constructor it give me the mentioned error above in comments. { |
Confirmed |
here is my guards in config/auth.php
|
Okay, so your app requires users to login with a username via the But then your user is logged in with the api guard. But all your permissions are assigned to the Simplest solution: use only 1 guard in your application: delete the |
You are right. the solution is : |
User doesn't have the right permissions
but login via passport works okay.
after seeding permissions, seeding roles and give permissions to them, adding new user and assign role. if found the follwoing
1- login response return all permissions correctly.
2- trying add middleware in constructor, it gives me user doesn't have the right permissions.
The text was updated successfully, but these errors were encountered: