{"id":18574522,"url":"https://github.com/trulymittal/api-authentication-nodejs","last_synced_at":"2025-04-07T19:16:18.688Z","repository":{"id":40644145,"uuid":"274622091","full_name":"trulymittal/API-Authentication-NodeJs","owner":"trulymittal","description":"API Authentication using JWT's (JSON Web Tokens). Plug n Play inside any app which requires authentication. NodeJs Express MongoDB \u0026 Redis.","archived":false,"fork":false,"pushed_at":"2022-12-22T17:05:42.000Z","size":322,"stargazers_count":226,"open_issues_count":10,"forks_count":100,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-31T16:21:46.952Z","etag":null,"topics":["api","authentication","expressjs","jwt","jwt-auth","jwt-authentication","jwt-token","jwt-tokens","mongodb","nodejs","redis"],"latest_commit_sha":null,"homepage":"","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/trulymittal.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}},"created_at":"2020-06-24T08:55:50.000Z","updated_at":"2025-03-20T19:52:03.000Z","dependencies_parsed_at":"2023-01-30T14:46:01.777Z","dependency_job_id":null,"html_url":"https://github.com/trulymittal/API-Authentication-NodeJs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trulymittal%2FAPI-Authentication-NodeJs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trulymittal%2FAPI-Authentication-NodeJs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trulymittal%2FAPI-Authentication-NodeJs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trulymittal%2FAPI-Authentication-NodeJs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trulymittal","download_url":"https://codeload.github.com/trulymittal/API-Authentication-NodeJs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247713258,"owners_count":20983683,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api","authentication","expressjs","jwt","jwt-auth","jwt-authentication","jwt-token","jwt-tokens","mongodb","nodejs","redis"],"created_at":"2024-11-06T23:15:41.844Z","updated_at":"2025-04-07T19:16:18.663Z","avatar_url":"https://github.com/trulymittal.png","language":"JavaScript","readme":"# API Authentication using NodeJs\n\nThis is an Authentication API using JWT's that you can plug inside your current project or you can start with a new one. Email \u0026 Password is used for authentication.\n\nThe API based on Node.js, Express, MongoDB \u0026 Redis, following the **MVC pattern** i.e. Model ~~View~~ Controller.\n\n**Mongoose** is used for storing Users in Database.\n**Redis** is used for storing Refresh Tokens - to validate them as well at the same time Blacklisting them.\n\nThe application is **production ready**.\n\n---\n\n## To start setting up the project\n\nStep 1: Clone the repo\n\n```bash\ngit clone https://github.com/trulymittal/API-Authentication-NodeJs.git\n```\n\nStep 2: cd into the cloned repo and run:\n\n```bash\nnpm install\n```\n\nStep 3: Put your credentials in the .env file.\n\n```bash\nPORT=3000\nMONGODB_URI=mongodb://localhost:27017\nDB_NAME=YOUR_DB_NAME\nACCESS_TOKEN_SECRET=GENERATE_FROM_GENERATE_KEYS_FILE_IN_HELPER\nREFRESH_TOKEN_SECRET=GENERATE_FROM_GENERATE_KEYS_FILE_IN_HELPER\n```\n\nStep 4: To generate 256-bit keys for JWT\n\n```bash\nnode ./helpers/generate_keys.js\n```\n\nStep 5: Install Redis (Linux Ubuntu)\n\n```bash\nsudo apt-get install redis-server\n```\n\nStep 6: Run Redis Server (Linux Ubuntu)\n\n```bash\nredis-server\n```\n\nStep 7: Install MongoDB (Linux Ubuntu)\n\nSee \u003chttps://docs.mongodb.com/manual/installation/\u003e for more infos\n\nStep 8: Run Mongo daemon\n\n```bash\nsudo service mongod start\n```\n\nStep 9: Start the API by\n\n```bash\nnpm start\n```\n\nStep 10 (Optional): Change the expiration time of Access Token and Refresh Token according to your needs by going inside the **`./helpers/jwt_helper.js`** file.\n\n## Author\n\n- [**Truly Mittal**](https://trulymittal.com)\n\n## Contribute\n\nYou can fork this repo and send me a PR.\n\n## License\n\nThis project is licensed under the MIT License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrulymittal%2Fapi-authentication-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrulymittal%2Fapi-authentication-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrulymittal%2Fapi-authentication-nodejs/lists"}