GP
04/28/2023, 8:41 AMexport class IdentityAndAccessModule implements NestModule, OnModuleInit {
...
static forRoot({ connectionURI, apiKey, appInfo, caslFactory }) {
const providers: Provider[] = [
...
{
useValue: {
appInfo,
connectionURI,
apiKey,
},
provide: ConfigInjectionToken,
},
SupertokensService,
PrismaService,
];
return {
module: IdentityAndAccessModule,
providers: providers,
exports: providers,
};
}
...
}
Then my 2 auth modules, one for normal users and one for admin:
@Module({
imports: [
PrismaModule,
// TODO: config
IdentityAndAccessModule.forRoot({
connectionURI: 'http://localhost:3567',
appInfo: {
appName: 'WC APP',
apiDomain: 'http://localhost:3001',
websiteDomain: 'http://localhost:3000',
apiBasePath: '/auth',
websiteBasePath: '/auth',
},
caslFactory: AppCaslFactory,
}),
],
providers: [AuthService, ...oauthProviders],
exports: [AuthService, IdentityAndAccessModule],
controllers: [],
})
export class CustomerAuthModule {}
and another one identical but using /admin/auth as base path for both API and website.
My problem is that the first module registered in app.module.ts, will be available but not the other one. So /auth/signin works but /admin/auth/signin always return 404. Any idea? I guess it comes from my module being setup as singleton but can't find any way to have multiple instances using its own configrp
04/28/2023, 9:17 AMGP
04/28/2023, 9:25 AMrp
04/28/2023, 9:26 AMGP
04/28/2023, 9:29 AMrp
04/28/2023, 9:30 AMGP
04/28/2023, 9:37 AMrp
04/28/2023, 9:40 AMGP
04/28/2023, 9:42 AM