# JWT and passport package help?

**URL:** <https://forum.freecodecamp.org/t/jwt-and-passport-package-help/419544>\
**Category:** General\
**Created:** [September 8, 2020, 9:27am UTC](https://forum.freecodecamp.org/t/jwt-and-passport-package-help/419544 "2020-09-08T09:27:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![priyanshushrama709](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/priyanshushrama709/32/150721_2.png) [@priyanshushrama709](https://forum.freecodecamp.org/u/priyanshushrama709)\
**Post date:** [September 8, 2020, 9:27am UTC](https://forum.freecodecamp.org/t/jwt-and-passport-package-help/419544/1 "2020-09-08T09:27:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![adaezebaby](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/adaezebaby/32/201644_2.png) [@adaezebaby](https://forum.freecodecamp.org/u/adaezebaby)\
**Post date:** [September 8, 2020, 9:32am UTC](https://forum.freecodecamp.org/t/jwt-and-passport-package-help/419544/2 "2020-09-08T09:32:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 6:41pm UTC](https://forum.freecodecamp.org/t/jwt-and-passport-package-help/419544/3 "2021-06-01T18:41:13Z")

</div>


