Google Oauth2 along with JWT using node.js and passport

Authentication and web tokens

Shivam Verma
4 min readOct 16, 2022
Google Images and medium.com

JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.

JWT will be used for token authentication in this blog along with oauth2. Through an authentication token, users can confirm their identity using the token-based authentication system, and in exchange, they get a special access token. Instead of having to re-enter credentials each time they return to the same webpage, app, or other resource secured with the same token, users can access the website or app for which the token has been granted for the duration of the token. Auth tokens function like a ticket with a stamp. As long as the token is active, the user has access. The token expires when the user logs out or closes an application. The classic password-based or server-based authentication methods are distinct from token-based authentication, a second layer of protection is provided through tokens, and administrators have extensive control.

Now you must have heard about oauth2 authentication and may have used it, but may not have integrated it with jwt for sending token to the frontend.

--

--

Shivam Verma

SWE @Microsoft || Building @shop2app || prev intern @daveai, @plunes & @rivi || Interview Preparation with me at https://topmate.io/shivam_verma10