{"id":21659226,"url":"https://github.com/ubergarm/openresty-nginx-jwt","last_synced_at":"2025-04-30T05:22:35.732Z","repository":{"id":70939120,"uuid":"68231403","full_name":"ubergarm/openresty-nginx-jwt","owner":"ubergarm","description":"JWT Bearer Token authorization with nginx, openresty, and lua-resty-jwt.","archived":false,"fork":false,"pushed_at":"2018-12-17T11:31:48.000Z","size":13,"stargazers_count":91,"open_issues_count":2,"forks_count":31,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T13:04:12.181Z","etag":null,"topics":["authorization","jwt-bearer","luarocks","nginx-jwt","openresty-module","reverse-proxy"],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ubergarm.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":"2016-09-14T18:16:34.000Z","updated_at":"2024-06-18T12:31:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"f37d9a35-a8bd-4c34-981b-2681ed8877b7","html_url":"https://github.com/ubergarm/openresty-nginx-jwt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubergarm%2Fopenresty-nginx-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubergarm%2Fopenresty-nginx-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubergarm%2Fopenresty-nginx-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ubergarm%2Fopenresty-nginx-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ubergarm","download_url":"https://codeload.github.com/ubergarm/openresty-nginx-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251645989,"owners_count":21620848,"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":["authorization","jwt-bearer","luarocks","nginx-jwt","openresty-module","reverse-proxy"],"created_at":"2024-11-25T09:30:41.923Z","updated_at":"2025-04-30T05:22:35.713Z","avatar_url":"https://github.com/ubergarm.png","language":"Lua","funding_links":[],"categories":["Lua"],"sub_categories":[],"readme":"openresty-nginx-jwt\n===\n[![](https://images.microbadger.com/badges/image/ubergarm/openresty-nginx-jwt.svg)](https://microbadger.com/images/ubergarm/openresty-nginx-jwt) [![](https://images.microbadger.com/badges/version/ubergarm/openresty-nginx-jwt.svg)](https://microbadger.com/images/ubergarm/openresty-nginx-jwt) [![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/ubergarm/openresty-nginx-jwt/blob/master/LICENSE)\n\nJWT Bearer Token authorization with `nginx`, `openresty`, and `lua-resty-jwt`.\n\nAn easy way to setup JWT Bearer Token authorization for any API endpoint, reverse proxy service, or location block without having to touch your server-side code.\n\n## Run\nThis example uses the secret, token, and claims from [jwt.io](https://jwt.io/):\n\nServer:\n```bash\ndocker run --rm \\\n           -it \\\n           -e JWT_SECRET=secret \\\n           -v `pwd`/nginx.conf:/nginx.conf \\\n           -v `pwd`/bearer.lua:/bearer.lua \\\n           -p 8080:8080 \\\n           ubergarm/openresty-nginx-jwt\n```\n\nClient:\n```bash\n# apt-get install httpie || brew install httpie\nhttp --print HBhb localhost:8080/secure/ \"Authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\"\n# token as url argument\nhttp --print HBhb localhost:8080/secure/?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\n# token as cookie\nhttp --print HBhb localhost:8080/secure/ \"Cookie:token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ\"\n```\n\n\n## Configure\nEdit `nginx.conf` to setup your custom location blocks.\n\nEdit `bearer.lua` or create new `lua` scripts to meet your specific needs for each location block.\n\nRestart a container and volume mount in all of the required configuration.\n\n## Build\nTo update or build a custom image edit the `Dockerfile` and:\n```bash\ndocker build -t ubergarm/openresty-nginx-jwt .\n```\n\n## Note\nI originally tried to get [auth0/nginx-jwt](https://github.com/auth0/nginx-jwt) working, but even the newer forks are not as straight forward as simply using `lua-resty-jwt` rock directly.\n\nIf you're looking for something beyond just JWT auth, check out [kong](https://getkong.org/) for all your API middleware plugin needs!\n\nAlso [Caddy](https://caddyserver.com/) might be faster for a simple project.\n\n## References\n* https://github.com/openresty/docker-openresty\n* https://github.com/SkyLothar/lua-resty-jwt\n* https://github.com/svyatogor/resty-lua-jwt\n* https://getkong.org/\n* https://jwt.io/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubergarm%2Fopenresty-nginx-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fubergarm%2Fopenresty-nginx-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fubergarm%2Fopenresty-nginx-jwt/lists"}