Laravel 2 api integration

I need to integrate 2 api with each other.Can i use laravel passport for this? My first api generate secret, second api use this token in every request ang getting user data by secret. I didn't find a solution for this in the laravel passport. Seem to be it only provides authorization via oauth2.

Upvotes: 0

Views: 125

Answers (1)

codenathan
codenathan

Reputation: 774

What you want to use is web tokens as opposed to oauth.

You need to use jwt for this:

https://jwt-auth.readthedocs.io/en/develop/laravel-installation/

Andrew Schmelyun on youtube shows you how to do this easily :

Securing a Laravel API in 20 minutes with JWTs

Update: Alternatively you can also use Laravel Sanctum for simple SPAs:

https://laravel.com/docs/8.x/sanctum

Upvotes: 1

Related Questions