Passport Laravel VS JWT

I was a little confused when I found out about the discrepancy between the Laravel Passport package and the tymondesigns / jwt-auth package. Do they really serve the same purpose of authenticating APIs through tokens? While Laravel Passport was introduced in 5. 3+, is it supposed to use Passport instead of the tymondesigns / jwt-auth package in recent versions?

+20
source share
1 answer

I had the same question, but after my research, I found that jwt is used in the passport. Passport is a package that implements Oauth2 and jwt.

"Laravel already simplifies authentication using traditional login forms, but what about APIs? APIs usually use tokens to authenticate users and do not support session state between requests. Laravel makes API authentication easier using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in minutes. The passport is based on the League OAuth2 server, which is served by Alex Bilby. "with https://laravel.com/docs/5.4/passport

Oauth2 can use jwt.

If you plan to just create email and password authentication with tymondesigns / jwt -A, that's fine. But if you use third-party authentication, you can use a passport. But an IMO passport is simpler and better than tymondesigns / jwt -A uth. I can also base this opinion on the fact that this is now the official Laravel package.

-A novice developer


For more details, I made an explanation of Laravel Passport, JWT, Oauth2 and Auth0 .

+27
source

Source: https://habr.com/ru/post/1270625/


All Articles