{"id":26910912,"url":"https://github.com/cabon-tech/jwt-auth-in-golang","last_synced_at":"2026-03-05T13:31:10.410Z","repository":{"id":224248613,"uuid":"760774919","full_name":"CABON-TECH/jwt-auth-in-golang","owner":"CABON-TECH","description":"This project demonstrates how to implement JWT (JSON Web Token) authentication in a Golang web application using Gin framework.","archived":false,"fork":false,"pushed_at":"2024-02-27T00:13:28.000Z","size":19,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T07:41:18.133Z","etag":null,"topics":["bycrypt","gin-framework","gin-gonic","golang","gorm-orm","jwt-auth","jwt-authentication","jwt-token","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Go","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/CABON-TECH.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-02-20T20:17:54.000Z","updated_at":"2024-03-29T18:41:38.000Z","dependencies_parsed_at":"2024-02-26T20:48:25.846Z","dependency_job_id":null,"html_url":"https://github.com/CABON-TECH/jwt-auth-in-golang","commit_stats":null,"previous_names":["cabon-tech/jwt-auth-in-golang"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CABON-TECH%2Fjwt-auth-in-golang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CABON-TECH%2Fjwt-auth-in-golang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CABON-TECH%2Fjwt-auth-in-golang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CABON-TECH%2Fjwt-auth-in-golang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CABON-TECH","download_url":"https://codeload.github.com/CABON-TECH/jwt-auth-in-golang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246653117,"owners_count":20812249,"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":["bycrypt","gin-framework","gin-gonic","golang","gorm-orm","jwt-auth","jwt-authentication","jwt-token","postgresql"],"created_at":"2025-04-01T14:25:45.565Z","updated_at":"2026-03-05T13:31:09.684Z","avatar_url":"https://github.com/CABON-TECH.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# JWT Authentication in Golang\n\nThis project demonstrates how to implement JWT (JSON Web Token) authentication in a Golang web application using Gin framework.\n\n## Features\n\n- User signup: Users can register by providing a username, email, and password.\n- User login: Registered users can log in using their email and password.\n- JWT Authentication: JWT is used to generate and authenticate user tokens for secure access to protected routes.\n\n## Prerequisites\n\n- Go (v1.16 or later)\n- PostgreSQL (v9.5 or later)\n\n## Getting Started\n\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/CABON-TECH/jwt-auth-in-golang.git\n    ```\n\n2. Navigate to the project directory:\n\n    ```bash\n    cd jwt-auth-in-golang\n    ```\n\n3. Install dependencies:\n\n    ```bash\n    go mod tidy\n    ```\n\n4. Set up the PostgreSQL database:\n\n    - Create a PostgreSQL database named `jwt_db`.\n    - Update the database connection details in `initializers/connectDB.go` file.\n\n5. Set environment variables:\n\n    Create a `.env` file in the root directory and define the following environment variables:\n\n    ```plaintext\n    SECRET=your-secret-key\n    ```\n\n6. Run the application:\n\n    ```bash\n    go run main.go\n    ```\n\n7. Access the application in your web browser at `http://localhost:8080`.\n\n## API Endpoints\n\n### User Signup\n\n- **URL:** `/signup`\n- **Method:** POST\n- **Body:**\n\n    ```json\n    {\n        \"username\": \"Cabon TEch\",\n        \"email\": \"cabontech@gmail.com\",\n        \"password\": \"cabon123\"\n    }\n    ```\n\n### User Login\n\n- **URL:** `/login`\n- **Method:** POST\n- **Body:**\n\n    ```json\n    {\n        \"email\": \"cabontech@gmail.com\",\n        \"password\": \"cabon123\"\n    }\n    ```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcabon-tech%2Fjwt-auth-in-golang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcabon-tech%2Fjwt-auth-in-golang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcabon-tech%2Fjwt-auth-in-golang/lists"}