By the way: Here is the snippet of the auth servic...
# support-questions-legacy
e
By the way: Here is the snippet of the auth service i implemented where i inject dependencies in NestJS e.g. when overriding signUp callbacks and want to do some action on other services.
auth.service.ts
Copy code
ts
import supertokens from 'supertokens-node';
import EmailPassword from 'supertokens-node/recipe/emailpassword';
import Session from 'supertokens-node/recipe/session';
import { Injectable, Logger } from '@nestjs/common';

@Injectable()
export class AuthService {
  constructor(private userService: UserService) {
    supertokens.init({
      supertokens: {
        connectionURI: 'http://localhost:3567',
      },
      appInfo: {
        appName: 'My App',
        apiDomain: 'http://localhost:3000',
        websiteDomain: 'http://localhost:3001',
      },
      recipeList: [
        EmailPassword.init(),
        Session.init(),
      ],
    });
  }
}
auth.module.ts
Copy code
ts
import { DynamicModule, MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
import { UserService } from 'src/user/user.service';
import { AuthMiddleware } from './auth.middleware';
import { AuthService } from './auth.service';

@Module({
  providers: [AuthService, UserService],
  exports: [],
  controllers: [],
})
export class AuthModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(AuthMiddleware).forRoutes('*');
  }

  static forRoot(): DynamicModule {
    return {
      providers: [],
      exports: [],
      imports: [],
      module: AuthModule,
    };
  }
}