0

I have a Laravel 6 application and installed Laravel Sanctum. Have followed these steps [1]. If I run sanctum/token via Postman I get a token as a response. When I open a protected route with this token set as bearer I always get unauthenticated.

When I look in the database the table personal_access_tokens is empty. While I create the token via:

$token = $user->createToken('auth_token')->plainTextToken;

Anyone have an idea why it doesn't store the token in the database?

[1] https://laravel.com/docs/9.x/sanctum#mobile-application-authentication

Joost
  • 87
  • 2
  • 5
  • Hello @joost- cross check you have done configuration in karnel.php as well as HasApiToken Trait in your user model, as well as checkout your api.php it should have middleware auth.sanctum. if you have missed out any configuration checkout missing configuration and migrations through sanctum document https://laravel.com/docs/9.x/sanctum#mobile-application-authentication – Manish J Jul 01 '22 at 17:07
  • Thanks for your response. I did al the steps you mention. – Joost Jul 01 '22 at 18:15

0 Answers0