Laravel Passport vs Sanctum: What's the difference?

preview_player
Показать описание
In this short 8 minute video, I'll explain the similarities and differences between two first-party Laravel authentication packages: Passport and Sanctum.

You'll learn about how:

- Both can create authentication tokens
- Both can guard routes
- Sanctum can be used with SPAs
- Passport uses a full OAuth2 workflow

- 0:00 Intro
- 00:36 Similarities
- 03:39 Differences
- 07:58 Wrapping Up

Рекомендации по теме
Комментарии
Автор

Thanks for a great video as always.

At 6:19 you're correct that tokens don't expire by default but Sanctum 3 introduced tokens expiration that was long overdue. So both Passport and Sanctum support expiration.

Samuel.Mwangi
Автор

Thanks for the vid Andrew. I'd like to see more about the sanctum token flow.
By the way, scopes/abilities are more readable when they are 'view:posts' rather than 'views:posts' because we later could use them as user()->can('view:posts').

andreich
Автор

In cookie based auth in SPA sanctum the Auth::guard('web')->logout() does not work. I had to delete the cookie in frontend app to be unauthorized by the backend server. I don't understand why they Didn't fix it?

ashikmehermobin
Автор

laravel sanctum v3.0++ can set sanctum api token expiration now

wahyusetya
Автор

Both packages are great so why people go to jwt package

mahmoudadel
join shbcf.ru