nest-azure-ad-tokenator
v3.0.0
Published
Nest Framework modules for requesting tokens from Azure AD client credential JWT tokens
Maintainers
Readme
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-tokenatorRegister 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
- Author - Seth Dix
License
NEST Azure AD Tokenator is MIT licensed.
