jwt authentication in adonisJs v5 #1365
-
Hi, Thanks :) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
V5 doesn't support JWT by default, but you could create your own implementation. Create Token on login, verify with middleware |
Beta Was this translation helpful? Give feedback.
-
See the documentation here |
Beta Was this translation helpful? Give feedback.
-
@mayureshnw What's your use case for using JWT over opaque (or api) tokens? |
Beta Was this translation helpful? Give feedback.
-
I did an implementation using adonis guard, which I consider to be the "most correct" way. |
Beta Was this translation helpful? Give feedback.
-
Whether it's an opaque token or a JWT token, both are important and useful in different scenarios. People choose to use JWT tokens because they fit better with microservice and serverless architectures, especially if you don't want to manage the token on the server side. Imagine if we used opaque tokens with serverless architecture; whenever we need auth user information or some session data stored, would we have to hit an API endpoint to the service that provides auth user information every time? Adonis is a very good framework with everything ready to use. However, the major downside is that it still clings to an old-school architecture. It would be great if Adonis were designed to better support microservice and serverless architectures. But I probably won't see that happening, as the direction taken by the framework's developers seems to completely block this possibility. |
Beta Was this translation helpful? Give feedback.
@mayureshnw What's your use case for using JWT over opaque (or api) tokens?