{"id":36483348,"url":"https://github.com/forgiv/simplejwt","last_synced_at":"2026-01-12T01:05:18.241Z","repository":{"id":57708594,"uuid":"217353823","full_name":"forgiv/simplejwt","owner":"forgiv","description":"A JWT package that keeps it simple.","archived":false,"fork":false,"pushed_at":"2019-10-28T20:13:17.000Z","size":39,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-16T02:50:50.557Z","etag":null,"topics":["go","jwt"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/forgiv/simplejwt","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/forgiv.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}},"created_at":"2019-10-24T17:19:36.000Z","updated_at":"2021-04-01T12:56:10.000Z","dependencies_parsed_at":"2022-09-09T22:22:04.608Z","dependency_job_id":null,"html_url":"https://github.com/forgiv/simplejwt","commit_stats":null,"previous_names":["forgiv/simple-jwt"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/forgiv/simplejwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgiv%2Fsimplejwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgiv%2Fsimplejwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgiv%2Fsimplejwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgiv%2Fsimplejwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forgiv","download_url":"https://codeload.github.com/forgiv/simplejwt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forgiv%2Fsimplejwt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28330221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["go","jwt"],"created_at":"2026-01-12T01:05:16.824Z","updated_at":"2026-01-12T01:05:18.236Z","avatar_url":"https://github.com/forgiv.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple JWT [![GoDoc](https://godoc.org/github.com/forgiv/simplejwt?status.svg)](https://godoc.org/github.com/forgiv/simplejwt)\n\nA **VERY** basic JWT implementation for those that just want a basic HS256 JWT token.  \nThe motiviation for this project was to learn about making JWT tokens in Go, and also because the alternatives are all just a little too complicated when I want a quick and dirty setup.\n\n**This package is still in an unstable state**  \n**You probably shouldn't use this package in production.**\n\n## Requirements\n\nThis package doesn't depend on anything other than the standard go library.  \nHowever, a couple environment variables are required to get it working.\n- `JWT_SECRET` is a random string for generating your hash\n- `JWT_EXPIRY` is the number of seconds before a token expires\n  - Defaults to 24 hours if environment variable isn't found\n- `JWT_REFRESH` is the number of seconds after expiration that a token can no longer be refreshed\n  - Defaults to 48 hours after expiry\n\n## Usage\n\nMake a claim\n```go\nclaim := \u0026simplejwt.Claim{}\n```\n\nOptionally you can give your claim some data.\n```go\nclaim.Data = \"Hello\"\n```\n\nClaim data is an interface so anything goes.\n```go\ntype User struct {\n  Username string `json:\"username\"`\n  password string // only exported data is used when creating JWT\n}\nuser := \u0026User{ \"Hiram\", \"simpleJWT\" }\n\nclaim := \u0026simplejwt.Claim{}\nclaim.Data = user\n// or more simply claim := \u0026Claim{ user }\n```\n\nOnce you have your claim, you can build your JWT.\n```go\ntoken, err := simplejwt.BuildJWT(claim)\nif err != nil {\n  // Handle the error!\n}\n```\n\nWhen it's time to verify a token, just use `ValidateJWT`\n```go\nif simplejwt.ValidateJWT(token) {\n  fmt.Println(\"Yay, we have a valid token!\")\n} else {\n  fmt.Println(\"Boo, this token isn't valid!\")\n}\n```\n\nWant to refresh an expired token?  \n`RefreshJWT` will refresh the `expiry` and `issued at` dates of a JWT token.  \nIt uses the existing data in the token to create a new token, so if you have new data to put in the token don't rely on a refresh.  \n`RefreshJWT` will return an error if the token cannot be refreshed for any reason.\n```go\nnewToken, err := simplejwt.RefreshJWT(oldToken)\nif err != nil {\n  // Handle error\n}\n```\n\nWant to use different environment variables?  \nSet them before you call `BuildJWT`, `ValidateJWT`, `RefreshJWT`.\n```go\nsimplejwt.ExpiryName = \"MY_CUSTOM_EXPIRY_VARIABLE\"\nsimplejwt.SecretName = \"MY_CUSTOM_SECRET_VARIABLE\"\nsimplejwt.RefreshName = \"MY_CUSTOM_REFRESH_VARIABLE\"\n```\n\n## Misc Knowledge\n\nIf the package can't find the expiry or refresh environment variables it falls back to using the defaults while also logging that it's being used. This can get annoying if you plan to use the defaults. In order to suppress these logs, just set the `MuteFallbackLogs` variable to `true`\n```go\nsimplejwt.MuteFallbackLogs = true\n```\n\n## Caveats\n\n- Only supports a single Claim  \n~~Refreshing isn't handled and must be done manually~~  \n~~Required environment variable names are too general and can cause issues~~  \n\n## Roadmap\n\n\u003e All versions before version v1.0.0 are volatile\n\n- v0.2.0\n  - [x] mass refactor\n  - [x] first test\n- v0.3.0\n  - [x] better error handling\n  - [x] change env var names\n- v0.4.0\n  - [x] refreshing tokens\n- v0.5.0\n  - [ ] multiple claims\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforgiv%2Fsimplejwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforgiv%2Fsimplejwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforgiv%2Fsimplejwt/lists"}