From e5545043be8ece165ee63ea55cd39dd18ad96b82 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Sun, 17 Jan 2021 14:38:05 +0100 Subject: [PATCH] auth: hash auth token Since the auth token will be stored in hashed form in the db, we need to hash each provided auth token in order to search in the db for them. Signed-off-by: Philip Molares --- src/users/users.service.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/users/users.service.ts b/src/users/users.service.ts index cb27939fd..bde0de6ce 100644 --- a/src/users/users.service.ts +++ b/src/users/users.service.ts @@ -78,8 +78,9 @@ export class UsersService { } async getUserByAuthToken(token: string): Promise { + const hash = this.hashPassword(token); const accessToken = await this.authTokenRepository.findOne({ - where: { accessToken: token }, + where: { accessToken: hash }, }); if (accessToken === undefined) { throw new NotInDBError(`AuthToken '${token}' not found`);