Together with @spawnia and @lorado we are creating some examples for Laravel Lighthouse and we have some different opinions on sanctum role-based security practices.
Can you please review my following statement and tell me if I am wrong on what is the best way to move forward.
My idea:
Now for the tricky part, once I create a login mutation, I need to verify that the user has the corresponding role and generate a token ability based on that check, also when the app goes offline or enters PWA mode. I need to revoke any tokens with:
create
delete
update
I couldn't find in the docs any solutions to this problem, that is a real-world necessity.
I can only leave the show and index abilities active.
What I am thinking:
Create a custom arg resolver for the mutation somehow bring the middleware and generate a token based on roles
Bad idea: To store the role within the token.
Thanks for any insight into this.