domain added
This commit is contained in:
parent
600a1f7d75
commit
f5e87d7686
@ -235,7 +235,7 @@ export class AuthService {
|
||||
console.log("Error in introspectToken:", error.message || error);
|
||||
|
||||
if (error instanceof UnauthorizedException || error instanceof jwt.TokenExpiredError || error instanceof jwt.JsonWebTokenError || error instanceof jwt.NotBeforeError) {
|
||||
throw new UnauthorizedException('Authentication failed');
|
||||
throw new UnauthorizedException('Invalid Token');
|
||||
}
|
||||
|
||||
throw new InternalServerErrorException('Failed to introspect token');
|
||||
|
||||
@ -25,18 +25,18 @@ export class JwtAuthGuard implements CanActivate {
|
||||
}
|
||||
|
||||
// Decode the token without verifying the signature
|
||||
const decoded = jwt.decode(token) as { exp?: number };
|
||||
// const decoded = jwt.decode(token) as { exp?: number };
|
||||
|
||||
if (!decoded || !decoded.exp) {
|
||||
throw new UnauthorizedException('Authentication failed');
|
||||
}
|
||||
// if (!decoded || !decoded.exp) {
|
||||
// throw new UnauthorizedException('Authentication failed');
|
||||
// }
|
||||
|
||||
const currentTime = Math.floor(Date.now() / 1000); // in seconds
|
||||
// const currentTime = Math.floor(Date.now() / 1000); // in seconds
|
||||
|
||||
if (decoded.exp < currentTime) {
|
||||
console.log('Token expired');
|
||||
throw new UnauthorizedException('Invalid Token');
|
||||
}
|
||||
// if (decoded.exp < currentTime) {
|
||||
// console.log('Token expired');
|
||||
// throw new UnauthorizedException('Invalid Token');
|
||||
// }
|
||||
|
||||
// Token is valid and not expired - continue with your normal logic
|
||||
try {
|
||||
@ -44,6 +44,10 @@ export class JwtAuthGuard implements CanActivate {
|
||||
request.user = verifiedUser;
|
||||
return true;
|
||||
} catch (error) {
|
||||
if (error instanceof jwt.TokenExpiredError || error instanceof jwt.JsonWebTokenError || error instanceof jwt.NotBeforeError) {
|
||||
throw new UnauthorizedException('Invalid Token');
|
||||
}
|
||||
|
||||
if (error instanceof UnauthorizedException || error instanceof UE) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
@ -14,7 +14,13 @@ async function bootstrap() {
|
||||
logger: ['error', 'warn'],
|
||||
cors: {
|
||||
// origin: 'https://dev.alphaomegainfosys.com/',
|
||||
origin: ['http://localhost:3000', 'http://localhost:5173'],
|
||||
origin: [
|
||||
'http://localhost:3000',
|
||||
'http://localhost:5173',
|
||||
'https://policy.alphaomegainfosys.com',
|
||||
'https://sp.alphaomegainfosys.com',
|
||||
'https://client.alphaomegainfosys.com'
|
||||
],
|
||||
methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
||||
preflightContinue: false,
|
||||
optionsSuccessStatus: 204,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user