{"id":20424086,"url":"https://github.com/spm999/jwt-nodejs","last_synced_at":"2026-04-08T16:01:40.840Z","repository":{"id":219708367,"uuid":"749704193","full_name":"spm999/JWT-Nodejs","owner":"spm999","description":"Node APi to learn basic use of JWT","archived":false,"fork":false,"pushed_at":"2024-02-03T14:09:46.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-06T18:21:29.150Z","etag":null,"topics":["authentication","authorization","backend","expressjs","jwt-authentication","nodejs"],"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/spm999.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}},"created_at":"2024-01-29T08:23:35.000Z","updated_at":"2024-02-03T14:07:31.000Z","dependencies_parsed_at":"2024-02-03T15:23:45.405Z","dependency_job_id":"b03d8c91-5d70-4104-8420-6fa589d78d1e","html_url":"https://github.com/spm999/JWT-Nodejs","commit_stats":null,"previous_names":["spm999/jwt-nodejs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spm999/JWT-Nodejs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spm999%2FJWT-Nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spm999%2FJWT-Nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spm999%2FJWT-Nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spm999%2FJWT-Nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spm999","download_url":"https://codeload.github.com/spm999/JWT-Nodejs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spm999%2FJWT-Nodejs/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","backend","expressjs","jwt-authentication","nodejs"],"created_at":"2024-11-15T07:08:37.103Z","updated_at":"2026-04-08T16:01:40.823Z","avatar_url":"https://github.com/spm999.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWT Authentication with Express and Node\n\nThis is a simple Node.js and Express application demonstrating JWT (JSON Web Token) authentication. The application includes user login functionality, token generation, and a protected route that requires a valid JWT for access.\n\n## Installation\n\n1. **Clone this repository.**\n\n   ```bash\n   git clone https://github.com/spm999/JWT-Nodejs.git\n\n\n## Installation\n\n1. **Navigate to the project directory.**\n\n    ```bash\n    cd JWT-Nodejs\n    ```\n\n2. **Install dependencies.**\n\n    ```bash\n    npm install\n    ```\n\n## Usage\n\n1. **Start the server.**\n\n    ```bash\n    npm start\n    ```\n\n2. **Access the server at [http://localhost:3000](http://localhost:3000).**\n\n## Endpoints\n\n### User Login\n\n- **URL:** `/login`\n- **Method:** `POST`\n- **Description:** Allows users to log in and obtain a JWT token.\n- **Request Body:** Should include a JSON object with `username` and `password`.\n- **Response:** Returns a JWT token if the login is successful.\n\n### Protected Route\n\n- **URL:** `/protected`\n- **Method:** `GET`\n- **Description:** A protected route that requires a valid JWT for access.\n- **Authorization Header:** Should include a Bearer token obtained during login.\n- **Response:** Returns a message indicating successful access to the protected route if the token is valid.\n\n## JWT Authentication\n\nThe application uses a simple in-memory user database and a secret key for JWT signature. In a real-world scenario, replace the in-memory database with a proper database, and keep the secret key secure.\n\n## Contributing\n\nFeel free to contribute to this project by opening issues or submitting pull requests.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspm999%2Fjwt-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspm999%2Fjwt-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspm999%2Fjwt-nodejs/lists"}