|
|
|
@ -17,8 +17,6 @@ export class AuthService { |
|
|
|
) {} |
|
|
|
|
|
|
|
public async validateAnonymousLogin(accessToken: string): Promise<string> { |
|
|
|
return new Promise(async (resolve, reject) => { |
|
|
|
try { |
|
|
|
const hashedAccessToken = this.userService.createAccessToken({ |
|
|
|
password: accessToken, |
|
|
|
salt: this.configurationService.get('ACCESS_TOKEN_SALT') |
|
|
|
@ -29,19 +27,13 @@ export class AuthService { |
|
|
|
}); |
|
|
|
|
|
|
|
if (user) { |
|
|
|
const jwt = this.jwtService.sign({ |
|
|
|
return this.jwtService.sign({ |
|
|
|
id: user.id |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
resolve(jwt); |
|
|
|
} else { |
|
|
|
throw new Error(); |
|
|
|
} |
|
|
|
} catch { |
|
|
|
reject(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public async validateOAuthLogin({ |
|
|
|
provider, |
|
|
|
@ -75,7 +67,7 @@ export class AuthService { |
|
|
|
} catch (error) { |
|
|
|
throw new InternalServerErrorException( |
|
|
|
'validateOAuthLogin', |
|
|
|
error.message |
|
|
|
error instanceof Error ? error.message : 'Unknown error' |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|