DEV Community

Cover image for API Authentication using Laravel Sanctum

API Authentication using Laravel Sanctum

Suresh Ramani
I am working on Laravel, Vue.js, React.js ( Learning ), and a little bit familiar with Node.js,, and MongoDB. and I am do all stuff on Ubuntu so I familiar with Linux Operating System.
・1 min read

What is Laravel Sanctum?
Laravel Sanctum provides a featherweight authentication system for SPAs (single page applications), mobile applications, and simple, token-based APIs. Sanctum allows each user of your application to generate multiple API tokens for their account. These tokens may be granted abilities/scopes which specify which actions the tokens are allowed to perform. Here are some reasons you might want to choose Sanctum over Passport:

  1. Passport is implemented with OAuth2 authentication. If you are not using that, then Sanctum is your go-to for issuing API tokens.
  2. Sanctum is a featherweight, meaning it is light and simple to implement.
  3. Sanctum works with SPAs (Single Page Applications like Vue, Angular, and React) and supports mobile application authentication.

Discussion (0)

Forem Open with the Forem app