diff --git a/src/models/creation/CreateAuth.ts b/src/models/creation/CreateAuth.ts index 5e7cd9f..a1a8884 100644 --- a/src/models/creation/CreateAuth.ts +++ b/src/models/creation/CreateAuth.ts @@ -1,4 +1,5 @@ import { IsEmail, IsOptional, IsString } from 'class-validator'; +import * as jsonwebtoken from 'jsonwebtoken'; import { getConnectionManager } from 'typeorm'; import { PasswordNeededError, UserNotFoundError } from '../../errors/AuthError'; import { UsernameOrEmailNeededError } from '../../errors/UserErrors'; @@ -29,12 +30,14 @@ export class CreateAuth { if (found_users.length === 0) { throw new UserNotFoundError() } else { + const found_user = found_users[0] + const token = jsonwebtoken.sign(found_user, "sec") - // TODO: jwt creation - newAuth.access_token = "" - newAuth.refresh_token = "" - newAuth.access_token_expires_at = 1587349200 - newAuth.refresh_token_expires_at = 1587349200 + // TODO: jwt creation + newAuth.access_token = token + newAuth.refresh_token = token + newAuth.access_token_expires_at = 1587349200 + newAuth.refresh_token_expires_at = 1587349200 console.log(newAuth) }