{"id":25720345,"url":"https://github.com/legzdev/go-jwt","last_synced_at":"2025-06-25T05:44:00.510Z","repository":{"id":245726052,"uuid":"819062808","full_name":"legzdev/go-jwt","owner":"legzdev","description":"Simple, minimal and zero dependency Go JWT library","archived":false,"fork":false,"pushed_at":"2024-08-31T05:24:07.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-31T11:32:08.971Z","etag":null,"topics":["go","jwt"],"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/legzdev.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}},"created_at":"2024-06-23T17:08:09.000Z","updated_at":"2024-08-31T05:27:24.000Z","dependencies_parsed_at":"2024-06-23T18:29:29.697Z","dependency_job_id":"669bbc03-b560-44fd-826a-93be0f46ab26","html_url":"https://github.com/legzdev/go-jwt","commit_stats":null,"previous_names":["ghostsama2503/go-jwt","legzdev/go-jwt"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/legzdev/go-jwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/legzdev%2Fgo-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/legzdev%2Fgo-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/legzdev%2Fgo-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/legzdev%2Fgo-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/legzdev","download_url":"https://codeload.github.com/legzdev/go-jwt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/legzdev%2Fgo-jwt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261814947,"owners_count":23213819,"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":["go","jwt"],"created_at":"2025-02-25T17:41:33.429Z","updated_at":"2025-06-25T05:44:00.487Z","avatar_url":"https://github.com/legzdev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003ego-jwt\u003c/h1\u003e\n\nSimple, minimal and zero dependency Go JWT library.\n\n[![Go Version](https://img.shields.io/badge/go-1.22.3-007d9c?logo=go)](https://go.dev)\n[![Go Reference](https://pkg.go.dev/badge/github.com/ghostsama2503/go-jwt.svg)](https://pkg.go.dev/github.com/ghostsama2503/go-jwt)\n[![JWT Logo](https://img.shields.io/badge/JWT-gray?logo=JSON%20web%20tokens\u0026logoColor=white)](https://jwt.io)\n\n\u003c/div\u003e\n\n\n## Installation\n```shell\ngo get -u github.com/ghostsama2503/go-jwt\n```\n\n\n## Building and signing a token\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/ghostsama2503/go-jwt\"\n)\n\nfunc main() {\n\tsecretKey := []byte(\"secret\")\n\tcurrentTime := time.Now().UTC()\n\n\tclaims := \u0026jwt.CommonClaims{\n\t\tSubject:        \"test\",\n\t\tExpirationTime: currentTime.AddDate(0, 1, 0).Unix(),\n\t\tIssuedAtTime:   currentTime.Unix(),\n\t}\n\n\ttoken := jwt.New(claims)\n\n\tsignedToken, err := token.Signed(secretKey)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(signedToken)\n}\n```\n\n\n## Parsing and validating a token\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/ghostsama2503/go-jwt\"\n)\n\nfunc main() {\n\tsecretKey := []byte(\"secret\")\n\ttokenString := os.Getenv(\"TOKEN\")\n\n\ttoken, err := jwt.Parse(tokenString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := token.Validate(secretKey); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"valid token\")\n}\n```\n\n\n## Disclaimer\n\nIt's provided as-is, with no guarantees or warranties. It's a lightweight and easy-to-use solution for basic needs. For more robust solutions, please consider alternatives like [golang-jwt/jwt](https://github.com/golang-jwt/jwt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flegzdev%2Fgo-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flegzdev%2Fgo-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flegzdev%2Fgo-jwt/lists"}