Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Sanctum vs Passport [closed]

What are the differences between these 2? And which one is better for a simple VueJS app? I've read their documents a few times but still confused. Thank you very much.

like image 362
Daniel Avatar asked Mar 23 '20 11:03

Daniel


People also ask

Which is better sanctum or Passport in laravel?

If your application absolutely needs to support OAuth2, then you should use Laravel Passport. However, if you are attempting to authenticate a single-page application, mobile application, or issue API tokens, you should use Laravel Sanctum.

Which is better Passport or sanctum?

It depends on your requirements, Passport provides a full OAuth2 server implementation. If your project need to use OAuth implementation then use Passport. otherwise, the sanctum is a good choice.

Does laravel sanctum use JWT?

Laravel JWT authentication vs.Sanctum offers both session-based and token-based authentication and is good for single-page application (SPA) authentications. Passport uses JWT authentication as standard but also implements full OAuth 2.0 authorization.

Which is better JWT or Passport in laravel?

The "tymondesigns/jwt-auth" is a PHP Laravel implementation of the JWT protocol. On the other hand, Passport also uses JWT by default plus a huge extra, a complete Oauth2 implementation. Regarding the functionality, as I said they both use JWT thus you can use whichever you like to authentication via tokens.


Video Answer


1 Answers

Passport provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. It is therefore necessary to have a brief knowledge of OAuth2.

Sanctum it is a simple package to issue API tokens to your users without the complication of OAuth. Sanctum uses Laravel's built-in cookie based session authentication services.

In a small application use Sanctum. it's simple and easy.

like image 180
Wyll Sales Avatar answered Oct 24 '22 03:10

Wyll Sales