{"id":15160828,"url":"https://github.com/omar-alghaish/authentication-system","last_synced_at":"2026-02-07T10:02:52.022Z","repository":{"id":197086295,"uuid":"697972692","full_name":"omar-alghaish/Authentication-system","owner":"omar-alghaish","description":"This is an example of an API that uses an authentication and authorization system to challenge the user to validate credentials and check whether access is allowed by policies and rules","archived":false,"fork":false,"pushed_at":"2023-09-28T21:38:58.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-28T05:44:51.733Z","etag":null,"topics":["express-validator","expressjs","jwt","mongodb","mongoosejs","multer","nodejs","rest-api","sharp"],"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/omar-alghaish.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}},"created_at":"2023-09-28T21:30:25.000Z","updated_at":"2023-10-17T17:39:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"af9a1b45-35eb-4d8f-808d-39cba1ffa668","html_url":"https://github.com/omar-alghaish/Authentication-system","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"f07041c98a57108f51fcfb7a0610027028b54f32"},"previous_names":["omar-alghaish/authentication-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/omar-alghaish/Authentication-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar-alghaish%2FAuthentication-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar-alghaish%2FAuthentication-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar-alghaish%2FAuthentication-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar-alghaish%2FAuthentication-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/omar-alghaish","download_url":"https://codeload.github.com/omar-alghaish/Authentication-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/omar-alghaish%2FAuthentication-system/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266270381,"owners_count":23902731,"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":["express-validator","expressjs","jwt","mongodb","mongoosejs","multer","nodejs","rest-api","sharp"],"created_at":"2024-09-26T23:24:18.412Z","updated_at":"2026-02-07T10:02:51.988Z","avatar_url":"https://github.com/omar-alghaish.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentication and authorization system\n\nThis is an example of an API that uses an authentication and authorization system to challenge the user to validate credentials and check whether access is allowed by policies and rules\n\n## Project structre:\n\n```bash\n\n│   config.env\n│   index.js\n│   package-lock.json\n│   package.json\n│   README.md\n│\n├───configs\n│       database.js\n│       dotenv.js\n│       morgan.js\n│       server.js\n│\n├───controllers\n│       auth.controller.js\n│       handlerFactory.js\n│       user.controller.js\n│\n├───handlers\n├───middlewares\n│       error.Middleware.js\n│       limiter.js\n│       resizeImage.js\n│       uploadImage.middlesare.js\n│       validatorMiddleware.js\n│\n├───models\n│       model.option.js\n│       user.model.js\n│\n├───routes\n│       auth.route.js\n│       index.js\n│       user.route.js\n│\n├───templates\n│       restPassword.js\n│\n├───uploads\n│   └───users\n└───utils\n    │   apiError.js\n    │   apiFeatures.js\n    │   sendEmail.js\n    │\n    └───validators\n            authValidator.js\n            userValidator.js\n```\n\n## Running\n\n1-Clone repository.\n\n2-install dependencies\n\n```bash\nnpm install\n```\n\n3-run server\n\n```bash\n# for development\nnpm run start:dev\n\n# for production\nnpm run start:prod\n```\n\n# Usage\n\n## Admin endpoints\n\n\u003e get users\n\n#### REQUEST :\n\nGET http:/127.0.0.1:8000/api/v1/users\n\n#### RESPONSE :\n\n```json\n{\n  \"results\": 3,\n  \"pagination\": {\n    \"currentPage\": 1,\n    \"limit\": 20,\n    \"totalPages\": 1\n  },\n  \"data\": [\n    {\n      \"_id\": \"650f3caf4b1e715e5ee18c8\",\n      \"name\": \"omar alghaish\",\n      \"email\": \"omar@gmail.com\",\n      \"profileImg\": \"http://localhost:8000/users/user-169575322700.jpeg\",\n      \"password\": \"$2b$12$ltW9oyjeKf65aggOVtXRk.eGOLgiEERdhPFjAo0dfOLVBludvPJQe\",\n      \"passwordResetVerified\": false,\n      \"role\": \"admin\",\n      \"active\": true,\n      \"createdAt\": \"2023-09-23T19:29:51.345Z\",\n      \"updatedAt\": \"2023-09-26T19:20:05.322Z\",\n      \"__v\": 0,\n      \"slug\": \"omar-alghaish5\"\n    },\n    {\n      \"_id\": \"650f459f02344d837d1e1fc\",\n      \"name\": \"omar alghaish\",\n      \"email\": \"mark@gmail.com\",\n      \"profileImg\": \"http://localhost:8000/users/user-1695499678887.jpeg\",\n      \"password\": \"$2b$12$ltW9oyjeKf65aggOVtXRk.eGOLgiEERdhPFjAo0dfOLVBludvPJQe\",\n      \"passwordResetVerified\": false,\n      \"role\": \"user\",\n      \"active\": true,\n      \"createdAt\": \"2023-09-23T20:07:59.263Z\",\n      \"updatedAt\": \"2023-09-23T20:07:59.263Z\"\n    }\n  ]\n}\n```\n\n\u003e Create user\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/users/create\n\n#### RESPONSE :\n\n```json\n{\n  \"data\": {\n    \"name\": \"user3\",\n    \"slug\": \"user3\",\n    \"email\": \"user3@gmail.com\",\n    \"phone\": \"0102234234\",\n    \"password\": \"$2b$12$rPTZkhceq5giK2UKWxj9puZAPc.8j7e8x1aIZziHCWMSIDxbYaSES\",\n    \"passwordResetVerified\": false,\n    \"role\": \"user\",\n    \"active\": true,\n    \"_id\": \"6515e5689ecbbd4935eb90c\",\n    \"createdAt\": \"2023-09-28T20:43:20.744Z\",\n    \"updatedAt\": \"2023-09-28T20:43:20.744Z\"\n  }\n}\n```\n\n\u003e Update user\n\n#### REQUEST :\n\nPUT http:/127.0.0.1:8000/api/v1/users\n\n#### RESPONSE :\n\n```json\n{\n  \"data\": {\n    \"_id\": \"6515e5689ecbbd4935eb90c3\",\n    \"name\": \"user3\",\n    \"slug\": \"user3\",\n    \"email\": \"user3@gmail.com\",\n    \"phone\": \"01034343434\",\n    \"password\": \"$2b$12$rPTZkhceq5giK2UKWxj9puZAPc.8j7e8x1aIZziHCWMSIDxbYaSES\",\n    \"passwordResetVerified\": false,\n    \"role\": \"admin\",\n    \"active\": true,\n    \"createdAt\": \"2023-09-28T20:43:20.744Z\",\n    \"updatedAt\": \"2023-09-28T20:46:49.844Z\"\n  }\n}\n```\n\n\u003e Delete user\n\n#### REQUEST :\n\nDELETE http:/127.0.0.1:8000/api/v1/users\n\n## Users endpoints\n\n\u003e signUp\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/signup\n\n\u003e signIn\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/login\n\n\u003e get logged user data\n\n#### REQUEST :\n\nGET http:/127.0.0.1:8000/api/v1/users/me\n\n\u003e change password\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/users/changepassword/:id\n\n\u003e deactive user\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/users/me/deActive\n\n\u003e forget password\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/forgetpassword\n\n\u003e verify ResetCode\n\n#### REQUEST :\n\nPOST http:/127.0.0.1:8000/api/v1/verifyResetCode\n\n\u003e reset Password\n\n#### REQUEST :\n\nPUT http:/127.0.0.1:8000/api/v1/resetPassword\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomar-alghaish%2Fauthentication-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fomar-alghaish%2Fauthentication-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fomar-alghaish%2Fauthentication-system/lists"}