hasib32 / rest-api-with-lumen

Rest API boilerplate for Lumen micro-framework.
486 stars 144 forks source link

JWT? #43

Open Zyles opened 6 years ago

Zyles commented 6 years ago

JWT support maybe?

https://github.com/tymondesigns/jwt-auth

Thanks.

ibpavlov commented 6 years ago

Laravel Passport uses firebase/jwt and lcobucci/jwt to generate tokens. Why you need another way of authentication?

Zyles commented 6 years ago

Oh it does? I will look more into it.

Using JWT to secure multiple API endpoints, so you can pass authentication between 2+ APIs.

ibpavlov commented 6 years ago

JWT is just a token format. Here all generated tokens are in JWT format. This means that they contain some information that is signed by the server.

OAUTH2 is a standard way of generating those tokens for different cases. For JWT Authentication for API to API there is no single way to do it, or standard. The simplest case is to generate JWT token from one API and use it from the other to authenticate, but then it depends on the authorization you want to give to your token. https://github.com/tymondesigns/jwt-auth is just a different authentication. You can use oauth2 for the same things you will use it.

You can see a good discussion about JwT and Oauth difference. https://stackoverflow.com/questions/39909419/jwt-vs-oauth-authentication