How to create the Secure API's (Token based authentication) in laravel 9
Hi,
So I have created the new ecommerce website on the laravel 9 and now looking to create the Secure API's for it.
Then after that I need to create the API's to fetch all the catalog, customer data to my mobile application..
Can anybody suggest me a better approach or the blog which explains about the secure API? Would be grateful for your response
ALSO WHAT IS THE DIFFERENCE BETWEEN PASSPORT AND SANCTUM ? Which is better to create the secure APIs in laravel?
@khanareeb Why have you created a website with Laravel 9? Laravel 9 is an old version. The current version of Laravel is 10.x, with Laravel 11 due for release in Q1 2024, so within a few months you’re already going to be two major versions behind.
WHAT IS THE DIFFERENCE BETWEEN PASSPORT AND SANCTUM ?
Passport adds OAuth to your application. Sanctum is for simple API tokens and SPAs.
Which is better to create the secure APIs in laravel?
Define “better”. If you want to add OAuth to your application, you use Passport. If you want to build a SPA, you use Sanctum.