{"id":23841845,"url":"https://github.com/rodrigocqb/nestjs-auth0-module","last_synced_at":"2026-01-31T17:01:42.963Z","repository":{"id":265953102,"uuid":"896940004","full_name":"rodrigocqb/nestjs-auth0-module","owner":"rodrigocqb","description":"NestJS AuthModule including PermissionsGuard and Permissions decorator to ease integration with Auth0 - NPM package","archived":false,"fork":false,"pushed_at":"2024-12-01T21:28:55.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-07T17:51:22.670Z","etag":null,"topics":["auth","auth0","authentication","authorization","guard","jwt","nestjs","passport","permissions","scope"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-auth0-module","language":"TypeScript","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/rodrigocqb.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-01T17:17:01.000Z","updated_at":"2024-12-01T21:28:27.000Z","dependencies_parsed_at":"2024-12-03T20:17:08.589Z","dependency_job_id":null,"html_url":"https://github.com/rodrigocqb/nestjs-auth0-module","commit_stats":null,"previous_names":["rodrigocqb/nestjs-auth0-module"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/rodrigocqb/nestjs-auth0-module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocqb%2Fnestjs-auth0-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocqb%2Fnestjs-auth0-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocqb%2Fnestjs-auth0-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocqb%2Fnestjs-auth0-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rodrigocqb","download_url":"https://codeload.github.com/rodrigocqb/nestjs-auth0-module/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rodrigocqb%2Fnestjs-auth0-module/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28948356,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T14:26:55.697Z","status":"ssl_error","status_checked_at":"2026-01-31T14:26:52.545Z","response_time":128,"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":["auth","auth0","authentication","authorization","guard","jwt","nestjs","passport","permissions","scope"],"created_at":"2025-01-02T18:21:16.081Z","updated_at":"2026-01-31T17:01:42.958Z","avatar_url":"https://github.com/rodrigocqb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\nThis package is a NestJS Auth Module to help facilitate integration with [Auth0](https://auth0.com). It includes some other features such as Guards for Auth and Permissions as well as an in-build @Permissions decorator to extract permissions/access scopes.\n\nIf you would like to see new stuff added to this package, feel free to reach out to me either via email (rodrigocortibarros@gmail.com) or by opening an issue on the [Github repository](https://github.com/rodrigocqb/nestjs-auth0-module)!\n\n# Installation\n\nInstallation is pretty straightforward. Just install it using npm or your favourite package manager.\n\n```bash\nnpm i nestjs-auth0-module\n```\n\n# Usage\n\nI won't go into details on how to use Auth0 since their documentation is good enough as is. To use this package, you just need to get your audience (your created api) and issuer url (your tenant url) variables.\n\nYour `.env` file should look something like this:\n\n```shell\n# Auth0 config\nAUTH0_AUDIENCE=https://your-api.com\nAUTH0_ISSUER_URL=https://your-tenant-url.us.auth0.com/\n```\n\n## AuthModule\n\nYou can import this on your `app.module.ts` file or on another module. You need to pass the audience and issuer url params to the `AuthModule` to configure it using the `forRoot` method. To use environment variables, you would need either the `@nestjs/config` or the `dotenv` packages as you can see in the example below:\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { AppController } from './app.controller';\nimport { AppService } from './app.service';\nimport { AuthModule } from 'nestjs-auth0-module';\nimport { ConfigModule } from '@nestjs/config';\n\n@Module({\n  imports: [\n    ConfigModule.forRoot({ isGlobal: true }),\n    AuthModule.forRoot({\n      audience: process.env.AUTH0_AUDIENCE,\n      issuer: process.env.AUTH0_ISSUER_URL,\n    }),\n  ],\n  controllers: [AppController],\n  providers: [AppService],\n})\nexport class AppModule {}\n```\n\n## JwtAuthGuard\n\nThe `AuthModule` by itself doesn't do any magic. We need this little fellow here together with the `@UseGuards` decorator that comes with the `@nestjs/common` package.\n\nYou can use it both above the controller to affect all methods or just on the specific route you need authentication.\n\n```typescript\nimport { Controller, Get, UseGuards } from '@nestjs/common';\nimport { AppService } from './app.service';\nimport { JwtAuthGuard } from 'nestjs-auth0-module';\n\n@UseGuards(JwtAuthGuard)\n@Controller()\nexport class AppController {\n  constructor(private readonly appService: AppService) {}\n\n  @Get()\n  getHello(): string {\n    return this.appService.getHello();\n  }\n}\n```\n\nIn case the user does not pass a valid Auth0 token using the Bearer token format, it will throw a 401 error.\n\n## @Permissions and PermissionsGuard\n\nIn tandem with the `JwtAuthGuard`, we can also call our `PermissionsGuard` to validate the permissions/access scopes from the access token and see if they include the required permission(s) on the `@Permissions` decorator.\n\n```typescript\nimport { Controller, Get, UseGuards } from '@nestjs/common';\nimport { AppService } from './app.service';\nimport {\n  JwtAuthGuard,\n  Permissions,\n  PermissionsGuard,\n} from 'nestjs-auth0-module';\n\n@UseGuards(JwtAuthGuard, PermissionsGuard)\n@Controller()\nexport class AppController {\n  constructor(private readonly appService: AppService) {}\n\n  @Permissions('read:all')\n  @Get()\n  getHello(): string {\n    return this.appService.getHello();\n  }\n}\n```\n\nIn case the user does not have the required permission(s), it will throw a 403 error.\n\n### Multiple permissions\n\nJust add them to the decorator like the example below and the guard will validate them all.\n\n```typescript\n@Permissions('read:all', 'read:hello')\n@Get()\ngetHello(): string {\nreturn this.appService.getHello();\n}\n```\n\n## JwtStrategy\n\nIn most cases, you won't need this. It is only exported because you might want to extend it for more specific cases that aren't currently covered by this package.\nFeel free to reach out to me if you want to see more customization regarding this!\n\n# Demo repository\n\nIf you want, you can check out my [demo repository](https://github.com/rodrigocqb/nestjs-auth0-module-example) so you can see the integration with the package by yourself. It has just the base NestJS dependencies and the nestjs-auth0-module package.\n\n# License\n\nThis package is [MIT licensed](https://github.com/rodrigocqb/nestjs-auth0-module/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigocqb%2Fnestjs-auth0-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frodrigocqb%2Fnestjs-auth0-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frodrigocqb%2Fnestjs-auth0-module/lists"}