{"id":15394865,"url":"https://github.com/nilslice/jwt","last_synced_at":"2025-04-15T23:53:53.692Z","repository":{"id":57485479,"uuid":"48673556","full_name":"nilslice/jwt","owner":"nilslice","description":"simple JWT package to create, parse and verify tokens for client authentication","archived":false,"fork":false,"pushed_at":"2018-11-05T16:27:44.000Z","size":10,"stargazers_count":35,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T05:09:01.009Z","etag":null,"topics":["go","golang","jwt"],"latest_commit_sha":null,"homepage":null,"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/nilslice.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}},"created_at":"2015-12-28T04:18:36.000Z","updated_at":"2024-07-09T09:49:18.000Z","dependencies_parsed_at":"2022-09-07T09:00:27.071Z","dependency_job_id":null,"html_url":"https://github.com/nilslice/jwt","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Fjwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Fjwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Fjwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nilslice%2Fjwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nilslice","download_url":"https://codeload.github.com/nilslice/jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173061,"owners_count":21224481,"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","golang","jwt"],"created_at":"2024-10-01T15:24:45.445Z","updated_at":"2025-04-15T23:53:53.670Z","avatar_url":"https://github.com/nilslice.png","language":"Go","readme":"# JWT\n\n### Usage\n\t$ go get github.com/nilslice/jwt\n\npackage jwt provides methods to create and check JSON Web Tokens. It only implements HMAC 256 encryption and has a very small footprint, ideal for simple usage when authorizing clients\n\n```go\npackage main\n\nimport (\n\tauth \"github.com/nilslice/jwt\"\n\t\"fmt\"\n\t\"net/http\"\n\t\"strings\"\n)\n\nfunc main() {\n\thttp.HandleFunc(\"/auth/new\", func(res http.ResponseWriter, req *http.Request) {\n\t\tclaims := map[string]interface{}{\"exp\": time.Now().Add(time.Hour * 24).Unix()}\n\t\ttoken, err := auth.New(claims)\n\t\tif err != nil {\n\t\t\thttp.Error(res, \"Error\", 500)\n\t\t\treturn\n\t\t}\n\t\tres.Header().Add(\"Authorization\", \"Bearer \"+token)\n\n\t\tres.WriteHeader(http.StatusOK)\n\t})\n\n\thttp.HandleFunc(\"/auth\", func(res http.ResponseWriter, req *http.Request) {\n\t\tuserToken := strings.Split(req.Header.Get(\"Authorization\"), \" \")[1]\n\n\t\tif auth.Passes(userToken) {\n\t\t\tfmt.Println(\"ok\")\n\t\t} else {\n\t\t\tfmt.Println(\"no\")\n\t\t}\n\t})\n\n\thttp.ListenAndServe(\":8080\", nil)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilslice%2Fjwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnilslice%2Fjwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnilslice%2Fjwt/lists"}