diff --git a/packages/nocodb-nest/src/app.module.ts b/packages/nocodb-nest/src/app.module.ts index 16801f7ad7..540c4c97b7 100644 --- a/packages/nocodb-nest/src/app.module.ts +++ b/packages/nocodb-nest/src/app.module.ts @@ -60,6 +60,9 @@ import type { Provider, } from '@nestjs/common'; import { ClientService } from './services/client/client.service'; +import { AuthTokenStrategy } from './strategies/authtoken.strategy/authtoken.strategy'; +import { BaseViewStrategy } from './strategies/base-view.strategy/base-view.strategy'; +import { GoogleStrategy } from './strategies/google.strategy/google.strategy'; export const JwtStrategyProvider: Provider = { provide: JwtStrategy, @@ -135,6 +138,9 @@ export const JwtStrategyProvider: Provider = { LocalStrategy, ExtractProjectIdMiddleware, ClientService, + AuthTokenStrategy, + BaseViewStrategy, + GoogleStrategy, ], }) export class AppModule implements OnApplicationBootstrap { diff --git a/packages/nocodb-nest/src/filters/global-exception/global-exception.filter.ts b/packages/nocodb-nest/src/filters/global-exception/global-exception.filter.ts index 998e067ea4..1f992741b7 100644 --- a/packages/nocodb-nest/src/filters/global-exception/global-exception.filter.ts +++ b/packages/nocodb-nest/src/filters/global-exception/global-exception.filter.ts @@ -47,7 +47,8 @@ export class GlobalExceptionFilter implements ExceptionFilter { } // handle different types of exceptions - if (exception instanceof HttpException) { + // todo: temporary hack, need to fix + if (exception.getStatus?.()) { response.status(exception.getStatus()).json(exception.getResponse()); } else { response.status(500).json({ diff --git a/packages/nocodb-nest/src/services/client/client.service.ts b/packages/nocodb-nest/src/services/client/client.service.ts index dc8fcd9546..334d97171f 100644 --- a/packages/nocodb-nest/src/services/client/client.service.ts +++ b/packages/nocodb-nest/src/services/client/client.service.ts @@ -23,7 +23,6 @@ export class ClientService implements OnModuleInit { private jwtStrategy: JwtStrategy, @Inject(HttpAdapterHost) private httpAdapterHost: HttpAdapterHost, ) { - // this.server = this.httpAdapterHost.httpAdapter.getHttpServer(); } async onModuleInit() { diff --git a/packages/nocodb-nest/tests/unit/rest/tests/auth.test.ts b/packages/nocodb-nest/tests/unit/rest/tests/auth.test.ts index ecc26b2ecc..c2efcb1092 100644 --- a/packages/nocodb-nest/tests/unit/rest/tests/auth.test.ts +++ b/packages/nocodb-nest/tests/unit/rest/tests/auth.test.ts @@ -56,7 +56,7 @@ function authTests() { .expect(400); }); - it.only('Signin with valid credentials', async () => { + it('Signin with valid credentials', async () => { const response = await request(context.app) .post('/api/v1/auth/user/signin') .send({ @@ -73,7 +73,7 @@ function authTests() { .post('/api/v1/auth/user/signin') // pass empty data in await request .send({}) - .expect(400) + .expect(401) }); it('Signin with invalid credentials', async () => {