{"id":20603383,"url":"https://github.com/rvpanoz/scapp","last_synced_at":"2026-04-08T16:01:58.332Z","repository":{"id":89194321,"uuid":"230377769","full_name":"rvpanoz/scapp","owner":"rvpanoz","description":"JWT Authentication \u0026 Authorization in NodeJs/Express \u0026 MongoDB REST APIs","archived":false,"fork":false,"pushed_at":"2020-07-01T21:47:39.000Z","size":149,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T16:47:17.140Z","etag":null,"topics":["authentication","authorization","expressjs","jwt","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvpanoz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-12-27T05:18:49.000Z","updated_at":"2023-03-03T22:37:49.000Z","dependencies_parsed_at":"2023-06-14T09:15:27.699Z","dependency_job_id":null,"html_url":"https://github.com/rvpanoz/scapp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rvpanoz/scapp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvpanoz%2Fscapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvpanoz%2Fscapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvpanoz%2Fscapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvpanoz%2Fscapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvpanoz","download_url":"https://codeload.github.com/rvpanoz/scapp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvpanoz%2Fscapp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31562697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"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":["authentication","authorization","expressjs","jwt","nodejs"],"created_at":"2024-11-16T09:17:07.483Z","updated_at":"2026-04-08T16:01:58.327Z","avatar_url":"https://github.com/rvpanoz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scapp\n\nJWT Authentication \u0026 Authorization in NodeJs/Express \u0026 MongoDB REST APIs\n\n## Introduction\n\nThis application is a REST API that will enable to create a user, log in the registered user, log out a user from a single device, and log out a user from multiple devices. Using Node.js/Express and MongoDB with MongoDB Atlas, a cloud database service that hosts MongoDB databases to store our data.\n\n## How JWT it works?\n\nJWT stands for JSON Web Token and is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object. This information can be verified and trusted because it is digitally signed.\n\nJWTs can be signed using a secret (with the HMAC algorithm) or a public/private key pair using RSA or ECDSA. [jwt.io/introduction/](https://jwt.io/introduction/)\n\n## Start the server\n\nIn order to start the application and run the server which handles the authentication and authorization process you have to clone the repo into a directory and install the application's dependencies using npm or yarn\n\n```\nnpm install\n```\n\n```\nyarn\n```\n\nAfter the installation is complete run the server using the following command:\n\n```\nnpm start\n```\n\nIf everything goes as expected you will see a message in the terminal that the server is running at port 8000. You can change the server running in src/config.js file.\n\n![alt text](https://github.com/rvpanoz/scapp/raw/master/images/start.png \"Server start\")\n\n## Routes\n\nThere are five available routes:\n\n- POST /users/create\n- POST /users/login\n- GET /users/profile\n- POST /users/logout\n- POST /users/logoutall\n\n### Create a user\n\n---\n\nCreates a new user\n\n- **URL**\n\n  /users/create\n\n- **Method:**\n\n  `POST`\n\n- **Data Params**\n\n  username [Required]\n\n  password [Required]\n\n- **Success Response:**\n\n  - **Code:** 200 OK\u003cbr /\u003e\n    **Content:**\n    ```json\n    {\n      \"user\": {\n        \"_id\": \"5e249c499899e94e6dfde811\",\n        \"name\": \"Goo\",\n        \"email\": \"woodoo@goohoo.com\",\n        \"tokens\": [\n          {\n            \"_id\": \"5e263647a4a67c5c7ff0694b\",\n            \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...\"\n          }\n        ]\n      }\n    }\n    ```\n\n- **Error Response:**\n\n  - **Code:** 400 BAD REQUEST \u003cbr /\u003e\n\n- **Sample Call:**\n\n  ```javascript\n    curl -i -X POST -d \"{\\\"name\\\": \\\"Alan\\\", \\\"email\\\": \\\"woodoo@goohoo.com\\\", \\\"password\\\": \\\"ohshit\\\"}\" -H \"Content-Type: application/json\" http://localhost:8000/users/login\n  ```\n\n### Authenticate user\n\n---\n\nwork in progress..\n\n### Logout user from a device\n\n---\n\nwork in progress..\n\n### Logout user from all devices\n\n---\n\nwork in progress..\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvpanoz%2Fscapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvpanoz%2Fscapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvpanoz%2Fscapp/lists"}