From bddd81b80c8b36b682cd962702352380e05b29d9 Mon Sep 17 00:00:00 2001 From: Czekaj Tom Date: Sat, 6 Jan 2024 17:58:58 +0100 Subject: [PATCH] :test_tube: Add log to find major bug --- src/services/tokens.service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/tokens.service.ts b/src/services/tokens.service.ts index 970bb0c..5d1e838 100644 --- a/src/services/tokens.service.ts +++ b/src/services/tokens.service.ts @@ -21,10 +21,12 @@ export class TokensService{ const payload = new AtPayloadModel(userId); const token = this.jwtService.generateJWT({...payload}, this.configService.get("AT_DURATION"), this.configService.get("AT_KEY")); const expires = (this.jwtService.decodeJwt(token)).exp; + const sum = this.encryptionService.getSum(token).substring(0, 10); + console.log(token, sum); await this.prismaService.tokens.create({ data: { user_id: userId, - sum: this.encryptionService.getSum(token).substring(0, 10), + sum: sum, token: await this.encryptionService.hash(token), is_refresh: false, expires: new Date(expires * 1000) @@ -37,10 +39,12 @@ export class TokensService{ const payload = new RtPayloadModel(userId); const token = this.jwtService.generateJWT({...payload}, this.configService.get("RT_DURATION"), this.configService.get("RT_KEY")); const expires = (this.jwtService.decodeJwt(token)).exp; + const sum = this.encryptionService.getSum(token).substring(0, 10); + console.log(token, sum); await this.prismaService.tokens.create({ data: { user_id: userId, - sum: this.encryptionService.getSum(token).substring(0, 10), + sum, token: await this.encryptionService.hash(token), is_refresh: true, expires: new Date(expires * 1000)