Skip to content

Commit

Permalink
🧪 Add log to find major bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Xen0Xys committed Jan 6, 2024
1 parent aacc906 commit bddd81b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/services/tokens.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (<any>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)
Expand All @@ -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 = (<any>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)
Expand Down

0 comments on commit bddd81b

Please sign in to comment.