diff --git a/src/oauth2/oauth2.controller.ts b/src/oauth2/oauth2.controller.ts index a0b950a..281ab25 100644 --- a/src/oauth2/oauth2.controller.ts +++ b/src/oauth2/oauth2.controller.ts @@ -89,7 +89,7 @@ export class Oauth2Controller { @Get('microsoft/callback') @ApiResponse({ description: 'Redirects to the frontend with the JWT token', - status: HttpStatus.ACCEPTED, + status: HttpStatus.FOUND, }) @ApiNotFoundResponse({ description: 'OAuth2 is not enabled for Microsoft', @@ -123,7 +123,7 @@ export class Oauth2Controller { @Get('google/callback') @ApiResponse({ description: 'Redirects to the frontend with the JWT token', - status: HttpStatus.ACCEPTED, + status: HttpStatus.FOUND, }) @ApiNotFoundResponse({ description: 'OAuth2 is not enabled for Google', @@ -159,7 +159,7 @@ export class Oauth2Controller { @Get('facebook/callback') @ApiResponse({ description: 'Redirects to the frontend with the JWT token', - status: HttpStatus.ACCEPTED, + status: HttpStatus.FOUND, }) @ApiNotFoundResponse({ description: 'OAuth2 is not enabled for Facebook', @@ -195,7 +195,7 @@ export class Oauth2Controller { @Get('github/callback') @ApiResponse({ description: 'Redirects to the frontend with the JWT token', - status: HttpStatus.ACCEPTED, + status: HttpStatus.FOUND, }) @ApiNotFoundResponse({ description: 'OAuth2 is not enabled for GitHub', @@ -271,7 +271,7 @@ export class Oauth2Controller { }); return res - .status(HttpStatus.ACCEPTED) + .status(HttpStatus.FOUND) .redirect(`${this.url}/auth/callback?${urlSearchParams.toString()}`); } } diff --git a/test/oauth2.e2e-spec.ts b/test/oauth2.e2e-spec.ts index b13c6d9..43391e7 100644 --- a/test/oauth2.e2e-spec.ts +++ b/test/oauth2.e2e-spec.ts @@ -127,7 +127,7 @@ describe('OAuth2 (e2e)', () => { const name = faker.person.fullName(); const email = faker.internet.email().toLowerCase(); - it('should return 202 accepted and redirect with code', async () => { + it('should return 302 FOUND and redirect with code', async () => { const frontendUrl = `https://${configService.get('domain')}/auth/callback`; await cacheManager.set(`oauth_state:${state}`, provider, 120_000); const tokenScope = nock(host, { @@ -171,7 +171,7 @@ describe('OAuth2 (e2e)', () => { await request(app.getHttpServer()) .get(`${callbackPath}?code=${code}&state=${state}`) - .expect(HttpStatus.ACCEPTED) + .expect(HttpStatus.FOUND) .expect((res) => { expect(res.headers.location.startsWith(frontendUrl)).toBe(true);