3.0.0 • Published 7 months ago

nest-azure-ad-tokenator v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 months ago

NEST Azure AD Tokenator

Description

Nest Framework modules for requesting tokens from Azure AD based on scope (service requests vs user requests)

Scaffolded from nest-sftp (Nest framework module wrapper around ssh2-sftp-client).

Installation

$ npm install --save nest-azure-ad-tokenator

Register in AppModule

Register the AzureClientCredentialsModule in your App Module.

This version uses forRootAsync

import { AzureClientCredentialsModule } from 'nest-azure-ad-tokenator';

@Module({
  imports: [
    AzureClientCredentialsModule.forRootAsync({
      useFactory: (configService: ConfigService) => {
        return {
          applicationId: configService.get('APPLICATION_ID'),
          tenantId: configService.get('TENANT_ID'),
          clientSecret: configService.get('CLIENT_SECRET'),
        };
      },
      inject: [ConfigService],
      imports: [AppModule],
    }),
  ],
  controllers: [],
  providers: [ConfigService],
  exports: [ConfigService],
})
export class AppModule {}

Usage

export class AuthClient {
  constructor(
    private readonly azureClientCredentialsService: AzureClientCredentialsService,
  ) {}

  async getToken() {
    return await this.azureClientCredentialsService.getClientCredentialsToken();
  }
}

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

NEST Azure AD Tokenator is MIT licensed.

3.0.0

7 months ago

2.0.0

1 year ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

4 years ago