Generate API Token within admin panel
As admin I would like to be able create or generate api toke via admin panel
10 Replies
Just build a resource to generate them.
What resource should I create?
The one to interact with your tokens table...
Is it the personal_access_tokens table, Sir?
So build a new Resource for the EPRsonal Access Tokens, or add personal access tokens as a relationship on the users resource if you have created one.
Can I create a resource with different name, let say "API Tokens" but the class I will be using is user? Because I already have resource for my user and I don't want to merge them, I want them in a separate resource.
you can tell the resource what model to use
Are your tokens attached to the user model or as a relationship of the user model?
I am using laravel sanctum so I believe it is attached to user
Or do you think better to use the personal_access_tokens instead?
Fairly sure they have their own tokens table and it’s not part of the user table. Accessed via the trait