JWT and passport package help?

I am currently learn user authentication in node js and I am confuse which authentication method should I learn.
Session authentication vs JWT authentication.
Which approach is best please help me.

Many web applications use JSON Web Token (JWT) instead of sessions for authentication. In the token based application, the server creates JWT with a secret and sends the JWT to the client. The client stores the JWT (usually in local storage) and includes JWT in the header with every request. The server would then validate the JWT with every request from the client and sends response.

1 Like