Skip to content

Commit f28e597

Browse files
authored
Merge pull request #80 from tugascript/mobile-external
fix(oauth2): use found instead of accepted
2 parents 23ecc26 + 0201d5a commit f28e597

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/oauth2/oauth2.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class Oauth2Controller {
8989
@Get('microsoft/callback')
9090
@ApiResponse({
9191
description: 'Redirects to the frontend with the JWT token',
92-
status: HttpStatus.ACCEPTED,
92+
status: HttpStatus.FOUND,
9393
})
9494
@ApiNotFoundResponse({
9595
description: 'OAuth2 is not enabled for Microsoft',
@@ -123,7 +123,7 @@ export class Oauth2Controller {
123123
@Get('google/callback')
124124
@ApiResponse({
125125
description: 'Redirects to the frontend with the JWT token',
126-
status: HttpStatus.ACCEPTED,
126+
status: HttpStatus.FOUND,
127127
})
128128
@ApiNotFoundResponse({
129129
description: 'OAuth2 is not enabled for Google',
@@ -159,7 +159,7 @@ export class Oauth2Controller {
159159
@Get('facebook/callback')
160160
@ApiResponse({
161161
description: 'Redirects to the frontend with the JWT token',
162-
status: HttpStatus.ACCEPTED,
162+
status: HttpStatus.FOUND,
163163
})
164164
@ApiNotFoundResponse({
165165
description: 'OAuth2 is not enabled for Facebook',
@@ -195,7 +195,7 @@ export class Oauth2Controller {
195195
@Get('github/callback')
196196
@ApiResponse({
197197
description: 'Redirects to the frontend with the JWT token',
198-
status: HttpStatus.ACCEPTED,
198+
status: HttpStatus.FOUND,
199199
})
200200
@ApiNotFoundResponse({
201201
description: 'OAuth2 is not enabled for GitHub',
@@ -271,7 +271,7 @@ export class Oauth2Controller {
271271
});
272272

273273
return res
274-
.status(HttpStatus.ACCEPTED)
274+
.status(HttpStatus.FOUND)
275275
.redirect(`${this.url}/auth/callback?${urlSearchParams.toString()}`);
276276
}
277277
}

test/oauth2.e2e-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe('OAuth2 (e2e)', () => {
127127
const name = faker.person.fullName();
128128
const email = faker.internet.email().toLowerCase();
129129

130-
it('should return 202 accepted and redirect with code', async () => {
130+
it('should return 302 FOUND and redirect with code', async () => {
131131
const frontendUrl = `https://${configService.get<string>('domain')}/auth/callback`;
132132
await cacheManager.set(`oauth_state:${state}`, provider, 120_000);
133133
const tokenScope = nock(host, {
@@ -171,7 +171,7 @@ describe('OAuth2 (e2e)', () => {
171171

172172
await request(app.getHttpServer())
173173
.get(`${callbackPath}?code=${code}&state=${state}`)
174-
.expect(HttpStatus.ACCEPTED)
174+
.expect(HttpStatus.FOUND)
175175
.expect((res) => {
176176
expect(res.headers.location.startsWith(frontendUrl)).toBe(true);
177177

0 commit comments

Comments
 (0)