Improved & fixed some issues with JWT authentication.
This commit is contained in:
@ -13,7 +13,7 @@ export class AuthAccessService {
|
||||
|
||||
async generate(user: UserEntity) {
|
||||
const now = new Date();
|
||||
const limit = parseInt(this.config.getOrThrow('AUTH_JWT_ACCESS_TOKEN_EXPIRATION_MS'));
|
||||
const limit = parseInt(this.config.getOrThrow<string>('AUTH_JWT_ACCESS_TOKEN_EXPIRATION_MS'));
|
||||
const expiration = moment(now).add(limit, 'ms').toDate();
|
||||
|
||||
const token = await this.jwts.signAsync(
|
||||
@ -25,7 +25,7 @@ export class AuthAccessService {
|
||||
exp: expiration.getTime(),
|
||||
},
|
||||
{
|
||||
secret: this.config.getOrThrow('AUTH_JWT_ACCESS_TOKEN_SECRET'),
|
||||
secret: this.config.getOrThrow<string>('AUTH_JWT_ACCESS_TOKEN_SECRET'),
|
||||
}
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user