Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/oauth2/oauth2.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -271,7 +271,7 @@ export class Oauth2Controller {
});

return res
.status(HttpStatus.ACCEPTED)
.status(HttpStatus.FOUND)
.redirect(`${this.url}/auth/callback?${urlSearchParams.toString()}`);
}
}
4 changes: 2 additions & 2 deletions test/oauth2.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string>('domain')}/auth/callback`;
await cacheManager.set(`oauth_state:${state}`, provider, 120_000);
const tokenScope = nock(host, {
Expand Down Expand Up @@ -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);

Expand Down