The following "Authserver.js" file generates JWT token after verifing user credentials. And then, verify newly generated JWT token for further queries. This implementation is a pert of larger project and only focus on JWT token generation ande verification using Node.js. "index.html" is a web page that acts as a user-interface and interacts with "Authserver.js" file in the backend.
Instructions:
1.Install Node.js locally, which you can be followed by https://www.digitalocean.com/community/tutorial_series/how-to-install-node-js-and-create-a-local-development-environment.
-
Add jsonwebtoken (JSON Web Tokens) by running the following command: "npm install jsonwebtoken".
-
Run "Authserver.js" in Node.js environment.
-
Open "index.html" file in the web browser.