Skip to content

Commit c4e376b

Browse files
author
Lasim
committed
refactor(backend): simplify token handling in TokenService
1 parent f5295b5 commit c4e376b

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

services/backend/src/middleware/oauthMiddleware.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export function requireValidAccessToken() {
6161
lastName: tokenPayload.user.lastName,
6262
authType: 'oauth2',
6363
githubId: null
64+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6465
} as any; // Cast to any to avoid type conflicts with Lucia User type
6566

6667
request.log.debug({
@@ -207,6 +208,7 @@ export function requireAuthenticationAny() {
207208
lastName: tokenPayload.user.lastName,
208209
authType: 'oauth2',
209210
githubId: null
211+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
210212
} as any; // Cast to any to avoid type conflicts with Lucia User type
211213

212214
request.log.debug({

services/backend/src/routes/oauth2/consent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export default async function consentRoute(fastify: FastifyInstance) {
135135
request_id: request_id,
136136
client_id: authRequest.clientId,
137137
client_name: clientNames[authRequest.clientId] || authRequest.clientId,
138+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
138139
user_email: (request.user as any).email,
139140
scopes: scopesWithDescriptions,
140141
expires_at: authRequest.expiresAt.toISOString()

services/backend/src/services/oauth/authorizationService.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import { getDb, getSchema } from '../../db';
33
import { eq, and, lt } from 'drizzle-orm';
44
import { generateId } from 'lucia';
5-
import { hash, verify } from '@node-rs/argon2';
65
import crypto from 'node:crypto';
76
import type { FastifyBaseLogger } from 'fastify';
87

services/backend/src/services/oauth/tokenService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class TokenService {
202202
return null;
203203
}
204204

205-
const [rawToken, encodedPayload] = parts;
205+
const [encodedPayload] = parts;
206206

207207
// Decode payload
208208
let payload: AccessTokenPayload & { iat: number; exp: number };

0 commit comments

Comments
 (0)