Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel auth vs Passport vs Sanctum

What is the difference between Laravel auth, Passport and Sanctum and when are they used?

like image 918
Mostafa Ahmed Avatar asked Dec 22 '22 18:12

Mostafa Ahmed


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

Auth (Authentication) is the process of identifying the user credentials. In web applications, authentication is managed by sessions which take the input parameters such as email or username and password, for user identification. If these parameters match, the user is said to be authenticated.

Refrences:

  • Auth
  • Passport vs Sanctum

Hope it helps..

Thanks.

like image 182
Salman Zafar Avatar answered Dec 28 '22 06:12

Salman Zafar