{"id":15046751,"url":"https://github.com/auth0/multitenant-jwt-auth","last_synced_at":"2025-06-24T23:05:42.624Z","repository":{"id":28165125,"uuid":"31666092","full_name":"auth0/multitenant-jwt-auth","owner":"auth0","description":"This sample shows how to implement an API that authenticates using JWTs. It supports mutiple tenants and JWT blacklisting.","archived":false,"fork":false,"pushed_at":"2015-03-04T16:10:41.000Z","size":124,"stargazers_count":55,"open_issues_count":0,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-06T03:51:00.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/auth0.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-03-04T16:08:25.000Z","updated_at":"2024-06-20T17:35:48.000Z","dependencies_parsed_at":"2022-09-04T00:41:16.535Z","dependency_job_id":null,"html_url":"https://github.com/auth0/multitenant-jwt-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/auth0/multitenant-jwt-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fmultitenant-jwt-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fmultitenant-jwt-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fmultitenant-jwt-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fmultitenant-jwt-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0","download_url":"https://codeload.github.com/auth0/multitenant-jwt-auth/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0%2Fmultitenant-jwt-auth/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261771110,"owners_count":23207218,"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":[],"created_at":"2024-09-24T20:53:32.391Z","updated_at":"2025-06-24T23:05:42.549Z","avatar_url":"https://github.com/auth0.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multitenant JWT Auth sample\nThis sample shows how to implement an API that:\n\n* Uses JWTs for authentication\n* Uses claims in those JWTs for authorization\n* Supports multiple tenants\n* Supports blacklisting JWTs\n\n## Installation\nClone this repository. Then run:\n```\nnpm i\n```\n\n## Running the sample\nThe sample has two components:\n* A server that hosts the API\n* A CLI that can be used to perform requests to the API.\n\n### Running the server\n```\nnode server.js\n```\n\n### Using the CLI\n```\n./cli --help\n\n  Usage: cli [options]\n\n  Options:\n\n    -h, --help         output usage information\n    -V, --version      output the version number\n    --tenant \u003ctenant\u003e  The tenant id. Either \"tenant_1\" or \"tenant_2\"\n    --token \u003ctoken\u003e    The JWT for the tenant. Either 1 or 2\n```\n\nUsing each tenant token combo yields a different result:\n* Token 1 for **tenant_1** will send a response the users. The JWT has the correct scopes and is not blacklisted.\n  ```\n  \u003e ./cli --tenant tenant_1 --token 1\n  Success [{\"name\":\"Jane Doe\"},{\"name\":\"John Doe\"}]\n  ```\n\n* Token 2 for **tenant_1** will send a response with an error because the token is revoked.\n  ```\n  \u003e ./cli --tenant tenant_1 --token 2\n  {\"name\":\"UnauthorizedError\",\"code\":\"revoked_token\"}\n  ```\n  \n* Token 1 for **tenant_2** will send a response with an error because the token does not have the required scope.\n  ```\n  \u003e./cli --tenant tenant_2 --token 1\n  {\"name\":\"UnauthorizedError\",\"code\":\"insufficient_scopes\"}\n  ```\n  \n* Token 2 for **tenant_2** will send a response with an error because the token is revoked. It does not have the required scope, but that check is done before.\n  ```\n  \u003e ./cli --tenant tenant_2 --token 2\n  {\"name\":\"UnauthorizedError\",\"code\":\"revoked_token\"}\n  ```\n\n## Contributing\nJust send a PR, you know the drill.\n\n## Issues\nIf you find any issues or have suggestions please report them.\n\n## Author\n[Auth0](https://auth0.com/)\n\n## License\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fmultitenant-jwt-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0%2Fmultitenant-jwt-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0%2Fmultitenant-jwt-auth/lists"}