{"id":44624465,"url":"https://github.com/varunsathreya/go-jwt-auth","last_synced_at":"2026-02-14T15:01:55.212Z","repository":{"id":45901105,"uuid":"514890532","full_name":"VarunSAthreya/go-jwt-auth","owner":"VarunSAthreya","description":"A basic server written in Go for the JWT Authentication and Authorization based on user type.","archived":false,"fork":false,"pushed_at":"2023-12-19T00:18:55.000Z","size":83,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-01T08:49:48.994Z","etag":null,"topics":["docker","docker-compose","gin-gonic","go","golang","jwt","mongodb"],"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/VarunSAthreya.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-17T16:03:48.000Z","updated_at":"2023-06-08T15:07:32.000Z","dependencies_parsed_at":"2026-02-14T15:00:51.424Z","dependency_job_id":null,"html_url":"https://github.com/VarunSAthreya/go-jwt-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/VarunSAthreya/go-jwt-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarunSAthreya%2Fgo-jwt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarunSAthreya%2Fgo-jwt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarunSAthreya%2Fgo-jwt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarunSAthreya%2Fgo-jwt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VarunSAthreya","download_url":"https://codeload.github.com/VarunSAthreya/go-jwt-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VarunSAthreya%2Fgo-jwt-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29447768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T14:10:32.461Z","status":"ssl_error","status_checked_at":"2026-02-14T14:09:49.945Z","response_time":53,"last_error":"SSL_read: 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":["docker","docker-compose","gin-gonic","go","golang","jwt","mongodb"],"created_at":"2026-02-14T15:00:41.477Z","updated_at":"2026-02-14T15:01:55.201Z","avatar_url":"https://github.com/VarunSAthreya.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWT Authentication using GO\n\nThis is a basic server written in Go for the JWT Authentication and Authorization based on user type.\n\n## Tech Stack\n\n- [Go](https://golang.org/)\n- [Gin](https://github.com/gin-gonic/gin)\n- [JWT](https://jwt.io/)\n- [MongoDB](https://www.mongodb.com/)\n\n## Routes\n\n- `/users/signup`:\n  - Sign Up for a user.\n  - Requires data in the body:\n\n```json\n            {\n                \"first_name\": \"John\",\n                \"last_name\": \"Doe\",\n                \"email\": \"john@doe.com\",\n                \"password\": \"password\",\n                \"phone\": \"1234567890\",\n                \"user_type\": \"ADMIN\" // Can only be \"ADMIN\" or \"USER\"\n            }\n```\n\n- Returns user ID.\n\n- `/users/signin`:\n  - Sign In for a user.\n  - Requires data in the body:\n\n```json\n                {\n                    \"email\": \"john@doe.com\",\n                    \"password\": \"password\"\n                }\n```\n\n- Returns User object.\n\n- `/users/:id`:\n  - Get a user by ID.\n  - Requires `Authorization` token in request Header.\n  - Returns User object.\n\n- `/users`:\n  - Get all users, only available for `ADMIN` user type.\n  - Requires `Authorization` token and `uid` (User ID) in request Header.\n  - Returns total count and all users.\n\n## Installation\n\n### Prerequisites\n\n- [Docker](https://www.docker.com/)\n\n### Environment Variables\n\nCreate a `.env` file in the root directory of the project.\n\n```.env\nPORT = 8000\nMONGO_URL = mongodb://mongo:27017/\u003cdb name\u003e\nSECRET_KEY = \u003cJWT SECRET KEY\u003e\n```\n\n- In `MONGO_URL` it is \"mongodb://`mongo`:27017/\\\u003cdb name\u003e\" where `mongo` is the name of the container.\n- And change in `PORT` number should also be done in `Dockerfile` and `docker-compose.yml` files.\n\n### Build\n\n```bash\ndocker-compose build\n```\n\n### Run\n\n```bash\ndocker-compose up\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunsathreya%2Fgo-jwt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvarunsathreya%2Fgo-jwt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvarunsathreya%2Fgo-jwt-auth/lists"}