generated from fahricansecer/boilerplate-be
@@ -253,9 +253,14 @@ export class AuthService {
|
||||
tenantId: user.tenantId || undefined,
|
||||
};
|
||||
|
||||
const isAdmin = roles.includes('admin');
|
||||
const accessExpiration = isAdmin
|
||||
? '7d'
|
||||
: this.configService.get('JWT_ACCESS_EXPIRATION', '15m');
|
||||
|
||||
// Generate access token
|
||||
const accessToken = this.jwtService.sign(payload, {
|
||||
expiresIn: this.configService.get('JWT_ACCESS_EXPIRATION', '15m'),
|
||||
expiresIn: accessExpiration as any,
|
||||
});
|
||||
|
||||
// Generate refresh token
|
||||
@@ -276,10 +281,7 @@ export class AuthService {
|
||||
return {
|
||||
accessToken,
|
||||
refreshToken: refreshTokenValue,
|
||||
expiresIn:
|
||||
this.parseExpiration(
|
||||
this.configService.get('JWT_ACCESS_EXPIRATION', '15m'),
|
||||
) / 1000, // Convert to seconds
|
||||
expiresIn: this.parseExpiration(accessExpiration) / 1000, // Convert to seconds
|
||||
user: {
|
||||
id: user.id,
|
||||
email: user.email,
|
||||
|
||||
Reference in New Issue
Block a user