fix 1
This commit is contained in:
parent
3256b0a4a7
commit
5cc654d0d8
@ -184,7 +184,10 @@ export class AuthService {
|
|||||||
|
|
||||||
const { email } = decoded;
|
const { email } = decoded;
|
||||||
|
|
||||||
if (!email) throw new UnauthorizedException('Authentication failed');
|
if (!email) {
|
||||||
|
console.log("introspect token no email introspectToken mt");
|
||||||
|
|
||||||
|
throw new UnauthorizedException('Authentication failed');}
|
||||||
|
|
||||||
const sessionData = await this.getUserSession(email);
|
const sessionData = await this.getUserSession(email);
|
||||||
|
|
||||||
@ -203,7 +206,9 @@ export class AuthService {
|
|||||||
try {
|
try {
|
||||||
const uid = await this.getUserIdByEmail(email);
|
const uid = await this.getUserIdByEmail(email);
|
||||||
|
|
||||||
if (!uid) throw new UnauthorizedException('No user ID found for email.');
|
if (!uid) {
|
||||||
|
throw new UnauthorizedException('No user ID found for email.');
|
||||||
|
}
|
||||||
|
|
||||||
const userInfoUrl = `${this.USERS_URL}/${uid}/sessions`;
|
const userInfoUrl = `${this.USERS_URL}/${uid}/sessions`;
|
||||||
|
|
||||||
@ -229,6 +234,8 @@ export class AuthService {
|
|||||||
const decodedHeader = jwt.decode(token, { complete: true });
|
const decodedHeader = jwt.decode(token, { complete: true });
|
||||||
|
|
||||||
if (!decodedHeader || typeof decodedHeader !== 'object') {
|
if (!decodedHeader || typeof decodedHeader !== 'object') {
|
||||||
|
console.log("failed decode header in decodeToken mt");
|
||||||
|
|
||||||
throw new UnauthorizedException("Authentication failed")
|
throw new UnauthorizedException("Authentication failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,6 +246,8 @@ export class AuthService {
|
|||||||
const introspection = await this.introspectToken(token);
|
const introspection = await this.introspectToken(token);
|
||||||
|
|
||||||
if (!introspection.active) {
|
if (!introspection.active) {
|
||||||
|
console.log("introspection failed in decodeToken mt");
|
||||||
|
|
||||||
throw new UnauthorizedException("Authentication Failed")
|
throw new UnauthorizedException("Authentication Failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -25,15 +25,17 @@ export class JwtAuthGuard implements CanActivate {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(request.cookies);
|
// console.log(request.cookies);
|
||||||
|
|
||||||
console.log(token);
|
// console.log(token);
|
||||||
|
|
||||||
if (!token) {
|
if (!token) {
|
||||||
console.log("token not found")
|
console.log("token not found")
|
||||||
throw new UnauthorizedException('Authentication failed');
|
throw new UnauthorizedException('Authentication failed');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
console.log("entering decode token");
|
||||||
|
|
||||||
const verifiedUser = await this.authService.decodeToken(token);
|
const verifiedUser = await this.authService.decodeToken(token);
|
||||||
request.user = verifiedUser;
|
request.user = verifiedUser;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user