{"id":21296059,"url":"https://github.com/chornthorn/go-gin-jwt-auth","last_synced_at":"2026-05-09T06:03:07.119Z","repository":{"id":263827243,"uuid":"891505264","full_name":"chornthorn/go-gin-jwt-auth","owner":"chornthorn","description":"A Go-based REST API service implementing JWT authentication with refresh tokens using Gin framework and GORM.","archived":false,"fork":false,"pushed_at":"2024-11-20T13:18:41.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-11T20:40:52.414Z","etag":null,"topics":["gin-gonic","golang","gorm","jwt","migration","postgresql","rsa"],"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/chornthorn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"chornthorn","patreon":"chornthorn"}},"created_at":"2024-11-20T13:06:48.000Z","updated_at":"2024-11-20T13:18:45.000Z","dependencies_parsed_at":"2024-11-20T14:34:47.151Z","dependency_job_id":null,"html_url":"https://github.com/chornthorn/go-gin-jwt-auth","commit_stats":null,"previous_names":["chornthorn/go-gin-jwt-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chornthorn/go-gin-jwt-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chornthorn%2Fgo-gin-jwt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chornthorn%2Fgo-gin-jwt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chornthorn%2Fgo-gin-jwt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chornthorn%2Fgo-gin-jwt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chornthorn","download_url":"https://codeload.github.com/chornthorn/go-gin-jwt-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chornthorn%2Fgo-gin-jwt-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32809147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["gin-gonic","golang","gorm","jwt","migration","postgresql","rsa"],"created_at":"2024-11-21T14:18:55.043Z","updated_at":"2026-05-09T06:03:07.099Z","avatar_url":"https://github.com/chornthorn.png","language":"Go","funding_links":["https://github.com/sponsors/chornthorn","https://patreon.com/chornthorn"],"categories":[],"sub_categories":[],"readme":"# JWT Authentication Service\n\nA Go-based REST API service implementing JWT authentication with refresh tokens using Gin framework and GORM.\n\n## Features\n\n- User registration and authentication\n- JWT-based authentication with access and refresh tokens\n- RSA-based token signing\n- User profile management\n- PostgreSQL database integration\n- Middleware for protected routes\n\n## Prerequisites\n\n- Go 1.22 or higher\n- PostgreSQL\n\n## Environment Setup\n\n1. Clone the repository\n```bash\ngit clone https://github.com/chornthorn/jwt-auth-app.git\ncd jwt-auth-app\n```\n\n2. Create a `.env` file in the root directory by copying the `.env.example` file.\n\n3. Generate RSA key pairs for JWT signing:\n```bash\n# Create keys directory\nmkdir -p keys\n\n# Generate access token keys\nopenssl genrsa -out keys/access_private.pem 2048\nopenssl rsa -in keys/access_private.pem -pubout -out keys/access_public.pem\n\n# Generate refresh token keys\nopenssl genrsa -out keys/refresh_private.pem 2048\nopenssl rsa -in keys/refresh_private.pem -pubout -out keys/refresh_public.pem\n```\n\n## Running the Application\n\n1. Install dependencies:\n```bash\ngo mod download\n```\n\n2. Run the application:\n```bash\ngo run main.go\n```\n\n## API Endpoints\n\n### Public Routes\n- `POST /api/v1/auth/register` - Register a new user\n- `POST /api/v1/auth/login` - Login and get tokens\n- `POST /api/v1/auth/refresh` - Refresh access token (requires refresh token)\n\n### Protected Routes\n- `GET /api/v1/users/profile` - Get user profile\n- `PUT /api/v1/users/profile` - Update user profile\n- `GET /api/v1/token/info` - Get token information\n\n## Example Requests\n\n### Register\n```bash\ncurl -X POST http://localhost:8080/api/v1/auth/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"user@example.com\",\n    \"password\": \"password123\",\n    \"name\": \"John Doe\"\n  }'\n```\n\n### Login\n```bash\ncurl -X POST http://localhost:8080/api/v1/auth/login \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"email\": \"user@example.com\",\n    \"password\": \"password123\"\n  }'\n```\n\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchornthorn%2Fgo-gin-jwt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchornthorn%2Fgo-gin-jwt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchornthorn%2Fgo-gin-jwt-auth/lists"}