can you try $user->createToken('token-name', ['server:update'])->plainTextToken; https://laravel.com/docs/8.x/sanctum#token-abilities
How to Authorize API in Laravel 8
I am using Jetstream to authentication scraffold.
Now, I want to use Sanctum Package to Authorize my API.
But how will I save my token?
I didn't find any clear instruction.
In documentation there is a issuing system: https://laravel.com/docs/8.x/sanctum#issuing-mobile-api-tokens
But I want to do it while user will login I want to save the token.
How can I do it?
@nafeeur10 It defeats the point of using token-based authentication if you’re just going to save it to a database though.
With Sanctum, you either get a token that you supply on every subsequent API request, or you get a cookie that authenticates requests. You don’t save tokens to a database.
You keep tokens in client-side storage and send it with each request. The server then identifies the user from the token, and whether the token is valid or not.
Please or to participate in this conversation.