laravelvue.jsauthenticationsanctum

Laravel-Authentication: Passport vs Sanctum


I am new to Laravel and for practicing I am trying to create a website like GoFundMe but simpler with Laravel and Vue js. But am very confused with Laravel's authentication systems, even though I have read most of the questions here.

Which authentication system should I use ? is it ok to use Sanctum for authentication and then Spatie for user permissions?


Solution

  • You have to have a clear concept of the topic authentication & authorization first. You may use Laravel Sanctum powered by Laravel framework as well. Because it provides authentication support for SPAs (single-page applications), mobile applications, and simple, token-based APIs. You may also have a look at passport later.

    After passing your authentication, the topic authorization comes. You may use Gate. But as you are new to Laravel framework, then it seems to be a good choice to use laravel spatie for managing your permissions. But keep in mind that, it uses Gate concept under the hood.