{"id":15463064,"url":"https://github.com/sohamsshah/jwtization","last_synced_at":"2026-02-09T05:33:46.615Z","repository":{"id":104836297,"uuid":"270752262","full_name":"sohamsshah/JWTization","owner":"sohamsshah","description":"JWT web token authentication using Passport.js, Node.js, MongoDB, NodeMailer, Express.","archived":false,"fork":false,"pushed_at":"2022-12-22T16:54:26.000Z","size":1127,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-10T12:36:41.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sohamsshah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-08T17:01:47.000Z","updated_at":"2023-09-02T04:24:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"5e803750-a216-4021-8732-65cdf567651d","html_url":"https://github.com/sohamsshah/JWTization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sohamsshah/JWTization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohamsshah%2FJWTization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohamsshah%2FJWTization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohamsshah%2FJWTization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohamsshah%2FJWTization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sohamsshah","download_url":"https://codeload.github.com/sohamsshah/JWTization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sohamsshah%2FJWTization/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29257737,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T04:11:57.159Z","status":"ssl_error","status_checked_at":"2026-02-09T04:11:56.117Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T00:06:53.631Z","updated_at":"2026-02-09T05:33:46.569Z","avatar_url":"https://github.com/sohamsshah.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWTization\nJWTization is a web service that enables the authentication of the Users by making use of JWT Tokens. This includes actions\nsuch as Register, Login, View profile and Log Out. It is a simple Node.js Authentication-based Project.\n\n---\n---\n\n## INTRODUCTION\n\nA simple frontend website a setup for ease of understanding using EJS. The website is named as -\u003e 'Web 51'. A user has to first register and then when the User enters correct LOGIN Credentials, a verification link (with JWT token embedded) is sent to the User. When User clicks on the Link, then he is authenticated and can access the personal/secret content.\n\nAnother variant of the Project focusses solely on the Authentication process rather than UI. When the data is sent to the \"register\" route, the User is registered into the Database. Afterwards, when user Logins with correct Credentials, a JWT token is generated. If the User tries to access the profile route without the token, access is denied. With JWT token passed in the Authorization Header, the User now can access the profile content. This can be tested using API testing tool such as POSTMAN.\n\n### What is JWT?\n\n\u003e A JSON web token(JWT) is JSON Object which is used to securely transfer information over the web(between two parties). It can be used for an authentication system and can also be used for information exchange.The token is mainly composed of header, payload, signature\n\n### What is Passport and Passport-jwt?\n\n\u003e Passport is authentication middleware for Node.js. Extremely flexible and modular, Passport can be unobtrusively dropped in to any Express-based web application. Passport.js has more than 500 authentication strategies for authentication and security. Passport-jwt is one of those strategies. It is a Middleware that enables the user to direct at the Protected Routes after authenticating with a JWT token. If the User possesses the JWT token, the login activity is successful, else not.\n\n### What is Mongoose?\n\n\u003e Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports both promises and callbacks. It is a powerful tool to handle database efficiently.\n\n### What is Nodemailer?\n\n\u003e Nodemailer is a module for Node.js applications to ease the email sending processes. It is secure, Unicode support, multiple receipents capabilities etc. makes it more robust.\n\n---\n---\n\n## FEATURES:\n\n* Simple yet beautiful UI design \n* Database enabled\n* Register new User\n* Password Encyrption\n* Login Activity Authentication\n* Email Verification Link to the user\n* Access to the route only after authentication of token \n* Authenticated only after JWT token is verified\n* Profile Page\n* Logout \n---\n---\n\n## TECHNOLOGIES USED:\n\n* Runtime Environment: *Node.js*  \n* Back-end Framework: *Express* \n* Database: *MongoDB*\n* Database ODM : *Mongoose*\n* Middleware: *Passport.js*\n* Authentication Strategy : *Passport-jwt*\n* Frontend : *HTML, CSS, EJS*\n* Password Encyrption : *BcryptJS*\n* Mailing Service: *Nodemailer*\n* Database GUI : *Robo3T*\n* API testing Tool: *POSTMAN*\n\n---\n---\n\n## USAGE:\n\n### Clone this Repository using:\n`git clone https://github.com/sohamsshah/JWTization`\n\n### Install Dependancies:\n\nNode.js, NPM and MongoDB must have been installed to your local system.\nIn the terminal, go to the Project directory and run command:\n\n`npm install` \n\n### Setting up LOCAL MONGO-DB Server:\n\nSet up the MongDB server and CLI by running th following commands in the terminal:\n\n* For MongoDB Local Server set up:\n  `mongod`\n\n* For MongoDB CLI set up:\n  `mongo`\n\n### To choose which variant to RUN:\nAs discussed, this project is in two variants. (A) Authentication Service (tested with POSTMAN) and (B) Web 51 Website\n\u003cbr/\u003e\n\u003cb\u003e (A) In order to use raw Authentitcation Service (tested with POSTMAN) \u003c/b\u003e,\nWrite the code in server.js file as -\u003e `require('./routes/routes')(app,passport);` \u003cbr/\u003e \nComment out the complementary code. (Also explained the same in the server.js file in this repository) \nIn routes.js file, the routes of this project are defined. Other middleware authentication, user database, etc. are unchanged, so no other codes are modified.\n\u003cbr/\u003e\n\u003cb\u003e (B) In order to avail the Web 51 Website Email-Verification Service \u003c/b\u003e,\nWrite the code in the server.js file -\u003e `require('./routes/routes_2')(app,passport);` \u003cbr/\u003e\nIn routes_2.js file, the routes relating to the Email Verification Service + Authentication are defined along with the mailing service.\nOther middleware authentication, user database, etc. are unchanged, so no other codes are modified.\n\n\n### To Run Server:\n \n `nodemon server.js`\n \n### Nodemailer\n\nIn this \"Gmail\" is used as service. By default, the less secure apps/services are disallowed. Allow them by by clicking on this [link](https://myaccount.google.com/lesssecureapps)\n\n### Setting Up .env\nIn .env file, there are 3 fields:\nGMAIL_ID : \"your-gmail-id-here\"\nGMAIL_PWD: \"your-password-here\"\nSECRET: \"enter-any-long-string-for-encryption\"\n\n![Image](https://github.com/sohamsshah/JWTization/blob/master/Images/dot_env.PNG  \".env\")\n\n\n## DEMONSTRATION:\n\n\n### (A) *Authentication Service (tested using POSTMAN)*  \n\n#### 1. Signup Route\n---\n![Image-1](https://github.com/sohamsshah/JWTization/blob/master/Images/Postman_Images/signup.PNG \"Signup Route\")\n\n#### 2. Login Route\n\n---\n\n![Image-2](https://github.com/sohamsshah/JWTization/blob/master/Images/Postman_Images/login.PNG \"Login Route\")\n\n#### 3. Generated Token      \n\n---\n\n![Image-3](https://github.com/sohamsshah/JWTization/blob/master/Images/Postman_Images/generated_token.PNG \"Generated Token\")\n\n#### 4. Authenticated Access\n\n---\n\n![Image-4](https://github.com/sohamsshah/JWTization/blob/master/Images/Postman_Images/authenticated_access.PNG \"authenticated_access\")\n\n---\n---\n\n### (B) *Web 51 Website*  \n\n#### 1. Home Page\n---\n![Image-1](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/home.PNG \"Home Page\")\n\n#### 2. Register Page\n\n---\n\n![Image-2](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/register_page.PNG \"Register Page\")\n\n#### 3. Login Page      \n\n---\n\n![Image-3](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/login_page.PNG \"Login Page\")\n\n#### 4. Verification Link on Email\n\n---\n\n![Image-4](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/email_ss.PNG \"Email SS\")\n\n#### 5. Profile Page\n\n---\n\n![Image-5](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/profile_page.PNG \"Profile Page\")\n\n#### 6. Email sent Page\n\n---\n\n![Image-4](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/email_verification_success_page.PNG \"Email Sent Page\")\n\n#### 7. Failure Page\n\n---\n\n![Image-4](https://github.com/sohamsshah/JWTization/blob/master/Images/UI_images/failure_page.PNG  \"Failure Page\")\n\n---\n---\n\n## RESOURCES:\n\n* [Passport](http://www.passportjs.org/)\n* [NPM JS](https://www.npmjs.com/)\n* [Nodemailer](https://nodemailer.com/)\n* [London App Brewery](https://www.appbrewery.co/)\n* [Traversy Media](https://www.traversymedia.com/)\n\n---\n---\n\n## CONTRIBUTERS 💻:\n\n* [Soham Shah](https://github.com/sohamsshah/) (webFlayer 🎃)\n\n---\n---\n\n                           \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohamsshah%2Fjwtization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsohamsshah%2Fjwtization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohamsshah%2Fjwtization/lists"}