{"id":16672906,"url":"https://github.com/cngjo/golang-api-auth","last_synced_at":"2026-05-22T07:35:43.121Z","repository":{"id":177896935,"uuid":"660315537","full_name":"cngJo/golang-api-auth","owner":"cngJo","description":"Golang REST API with JWT Auth example","archived":false,"fork":false,"pushed_at":"2023-07-03T05:35:52.000Z","size":22,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-30T14:35:31.189Z","etag":null,"topics":["auth","example","golang","jwt","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","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/cngJo.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,"publiccode":null,"codemeta":null}},"created_at":"2023-06-29T18:23:56.000Z","updated_at":"2025-04-29T16:33:25.000Z","dependencies_parsed_at":"2023-07-10T23:16:29.700Z","dependency_job_id":null,"html_url":"https://github.com/cngJo/golang-api-auth","commit_stats":null,"previous_names":["cngjo/golang-api-auth"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cngJo/golang-api-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cngJo%2Fgolang-api-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cngJo%2Fgolang-api-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cngJo%2Fgolang-api-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cngJo%2Fgolang-api-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cngJo","download_url":"https://codeload.github.com/cngJo/golang-api-auth/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cngJo%2Fgolang-api-auth/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33333553,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-21T12:23:38.849Z","status":"online","status_checked_at":"2026-05-22T02:00:06.671Z","response_time":265,"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":["auth","example","golang","jwt","rest-api"],"created_at":"2024-10-12T12:07:38.263Z","updated_at":"2026-05-22T07:35:43.101Z","avatar_url":"https://github.com/cngJo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=center\u003e\n    \u003ch1\u003eGolang JWT auth with binary UUIDs\u003c/h1\u003e\n\u003c/div\u003e\n\nThis example project shows and example implementation of JWT authentication in Golang using binary UUIDs as primary keys.\n\nUnder the hood, the project uses [GORM](https://gorm.io/) as ORM and [Gin](https://github.com/gin-gonic/gin).\n\nThis is heavily inspired by this blog post [JWT Authentication in Golang](https://codewithmukesh.com/blog/jwt-authentication-in-golang/) and an example of [how to use binary UUIDs with GORM](https://github.com/dipeshdulal/binary-uuid-gorm). \n\n## Available Requests\n\n### `POST /api/v1/auth/register`\n\n**Body**\n\n```json\n{\n    \"name\": \"Test User\",\n    \"email\": \"me@example.com\",\n    \"username\": \"test.user\",\n    \"password\": \"change!M3\"\n}\n```\n\n**Response**\n\n```json\n{\n    \"userId\": \"--uuid--\",\n    \"email\": \"me@example.com\",\n    \"username\": \"test.user\"\n}\n```\n\n**Example**\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n-d '{\"name\": \"Test User\", \"email\": \"me@example.com\", \"username\": \"test.user\", \"password\": \"change!M3\"}' \\\nhttp://localhost:8080/api/v1/auth/register\n```\n\n### `POST /api/v1/auth/login`\n\n**Body**\n\n```json\n{\n    \"email\": \"me@example.com\",\n    \"password\": \"change!M3\"\n}\n```\n\n**Response**\n\n```json\n{\n    \"access_token\": \"--jwt--\",\n    \"refresh_token\": \"--jwt--\"\n}\n```\n\n**Example**\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n-d '{\"email\": \"me@example.com\", \"password\": \"change!M3\"}' \\\nhttp://localhost:8080/api/v1/auth/login\n```\n\n### `POST /api/v1/auth/refresh-token`\n\n**Body**\n\n```json\n{\n    \"refresh_token\": \"--jwt--\",\n}\n```\n\n**Response**\n\n```json\n{\n    \"access_token\": \"--jwt--\",\n    \"refresh_token\": \"--jwt--\"\n}\n```\n\n**Example**\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" \\\n-d '{\"refresh_token\": \"--jwt--\"}' \\\nhttp://localhost:8080/api/v1/auth/refresh-token\n```\n\n### `GET /api/v1/ping`\n\n**Response**\n\n```json\n{\n    \"message\": \"pong\"\n}\n```\n\n**Example**\n\n```bash\ncurl -X GET -H \"Content-Type: application/json\" \\\n-H \"Authorization: Bearer --jwt--\" \\\nhttp://localhost:8080/api/v1/ping\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcngjo%2Fgolang-api-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcngjo%2Fgolang-api-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcngjo%2Fgolang-api-auth/lists"}