Skip to content
This repository was archived by the owner on Apr 8, 2026. It is now read-only.

Commit 7d802ad

Browse files
committed
fix(OAuth2): add verificationKey to user response using genVerificationKey function
1 parent 2b85623 commit 7d802ad

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

dist/controllers/OAuth2Controller.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const inversify_1 = require("inversify");
1717
const inversify_express_utils_1 = require("inversify-express-utils");
1818
const describe_1 = require("../decorators/describe");
1919
const LoggedCheck_1 = require("../middlewares/LoggedCheck");
20+
const GenKey_1 = require("../utils/GenKey");
2021
function handleError(res, error, message, status = 500) {
2122
const msg = error instanceof Error ? error.message : String(error);
2223
res.status(status).send({ message, error: msg });
@@ -204,7 +205,7 @@ let OAuth2 = class OAuth2 {
204205
user_id: user.user_id,
205206
username: user.username
206207
});
207-
res.send(user);
208+
res.send({ ...user, verificationKey: (0, GenKey_1.genVerificationKey)(user.user_id) });
208209
}
209210
catch (error) {
210211
await this.createLog(req, 'oauth2_user_access', 500, undefined, {
@@ -345,7 +346,8 @@ __decorate([
345346
steam_avatar_url: "string",
346347
steam_id: "string",
347348
discord_id: "string",
348-
google_id: "string"
349+
google_id: "string",
350+
verificationKey: "string"
349351
},
350352
example: "GET /api/oauth2/user?code=abc123&client_id=456"
351353
}),

src/controllers/OAuth2Controller.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { IOAuth2Service } from "../services/OAuth2Service";
1212
import { ILogService } from "../services/LogService";
1313
import { describe } from "../decorators/describe";
1414
import { AuthenticatedRequest, LoggedCheck } from "../middlewares/LoggedCheck";
15+
import { genVerificationKey } from "../utils/GenKey";
1516

1617
function handleError(res: Response, error: unknown, message: string, status = 500) {
1718
const msg = error instanceof Error ? error.message : String(error);
@@ -296,7 +297,8 @@ export class OAuth2 {
296297
steam_avatar_url: "string",
297298
steam_id: "string",
298299
discord_id: "string",
299-
google_id: "string"
300+
google_id: "string",
301+
verificationKey: "string"
300302
},
301303
example: "GET /api/oauth2/user?code=abc123&client_id=456"
302304
})
@@ -328,7 +330,7 @@ export class OAuth2 {
328330
user_id: user.user_id,
329331
username: user.username
330332
});
331-
res.send(user);
333+
res.send({...user, verificationKey: genVerificationKey(user.user_id)});
332334
} catch (error) {
333335
await this.createLog(req, 'oauth2_user_access', 500, undefined, {
334336
client_id,

0 commit comments

Comments
 (0)