@dofe/sso-nestjs
v0.1.21
Published
NestJS integration for sso.dofe.ai internal service APIs.
Downloads
0
Readme
@dofe/sso-nestjs
NestJS integration for sso.dofe.ai internal service APIs.
Install
pnpm add @dofe/sso-nestjs @dofe/sso-node @nestjs/axiosUsage
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { SsoClientModule } from '@dofe/sso-nestjs';
@Module({
imports: [
SsoClientModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
baseUrl: config.getOrThrow('SSO_INTERNAL_API_URL'),
internalSecret: config.getOrThrow('INTERNAL_API_SECRET'),
serviceName: 'agents.dofe.ai',
}),
}),
],
})
export class AppModule {}import { Injectable } from '@nestjs/common';
import { SsoClientService } from '@dofe/sso-nestjs';
@Injectable()
export class ExampleService {
constructor(private readonly sso: SsoClientService) {}
async loadUser(userId: string) {
return this.sso.getUser(userId);
}
}For low-level access, use the underlying @dofe/sso-node client:
await this.sso.client.users.get(userId);
await this.sso.client.teams.getMembers(teamId);
await this.sso.client.permissions.check({ userId, teamId, permission });For migration from existing local SSO clients, SsoClientService also exposes flat helper methods:
await this.sso.getUser(userId);
await this.sso.getUserTeams(userId);
await this.sso.checkPermission(userId, permission, teamId);
await this.sso.getTeamMembers(teamId);
await this.sso.getUserTeamRole(teamId, userId);
await this.sso.getTenantMembers(tenantId);
await this.sso.getUserTenantRole(tenantId, userId);Boundary
This package wraps @dofe/sso-node with a Nest module and HttpService fetcher. It does not include Redis event subscribers, Prisma, migrations, seeds, or database connection logic.
