diff --git a/idp/src/users/users.service.ts b/idp/src/users/users.service.ts
index f5ec733..ff63a9d 100644
--- a/idp/src/users/users.service.ts
+++ b/idp/src/users/users.service.ts
@@ -124,6 +124,9 @@ export class UsersService {
}
if (client.clientSecret !== clientSecret) {
+ this.logger.error(
+ `Client ${clientId} provided invalid secret ${clientSecret}`,
+ );
throw new HttpException('Invalid client', 401);
}
@@ -132,21 +135,27 @@ export class UsersService {
}
if (grantType !== 'authorization_code') {
+ this.logger.error(
+ `Client ${clientId} provided invalid grant type ${grantType}`,
+ );
throw new HttpException('Invalid grant type', 401);
}
const token = await this.tokenRepo.findByCode(code);
if (!token) {
+ this.logger.error(`Token ${code} not found`);
throw new HttpException('Invalid token', 401);
}
if (token.client.id !== clientId) {
+ this.logger.error(`Token ${code} not found for client ${clientId}`);
throw new HttpException('Invalid token', 401);
}
const user = await this.userRepo.findById(token.user.id);
if (!user) {
+ this.logger.error(`User ${token.user.id} of token not found`);
throw new HttpException('Invalid token', 401);
}
@@ -185,10 +194,12 @@ export class UsersService {
async getNewAccessToken(refreshToken: string) {
const payload = this.jwtService.verify(refreshToken);
if (payload.type !== 'refresh') {
+ this.logger.error(`Token ${refreshToken} is not a refresh token`);
throw new HttpException('Invalid token', 401);
}
const user = await this.userRepo.findById(payload.id);
if (!user) {
+ this.logger.error(`User ${payload.id} not found for refresh token`);
throw new HttpException('Invalid token', 401);
}
@@ -206,6 +217,7 @@ export class UsersService {
const decoded = this.jwtService.verify(token);
return decoded;
} catch (e) {
+ this.logger.error(`Token ${token} is invalid. Error: ${e.message}`);
throw new HttpException(e.message, 401);
}
}
diff --git a/idp_client/angular.json b/idp_client/angular.json
index 5d97d13..d5d9d93 100644
--- a/idp_client/angular.json
+++ b/idp_client/angular.json
@@ -72,6 +72,9 @@
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
+ "options": {
+ "proxyConfig": "proxy.conf.json"
+ },
"configurations": {
"production": {
"buildTarget": "idp_client:build:production"
diff --git a/idp_client/proxy.conf.json b/idp_client/proxy.conf.json
new file mode 100644
index 0000000..a44d265
--- /dev/null
+++ b/idp_client/proxy.conf.json
@@ -0,0 +1,11 @@
+{
+ "/api": {
+ "target": "http://localhost:5000",
+ "secure": false,
+ "logLevel": "debug",
+ "changeOrigin": true,
+ "pathRewrite": {
+ "^/api": "/api"
+ }
+ }
+}
\ No newline at end of file
diff --git a/idp_client/src/app/auth/login/login.component.html b/idp_client/src/app/auth/login/login.component.html
index 15dd8a2..bc30657 100644
--- a/idp_client/src/app/auth/login/login.component.html
+++ b/idp_client/src/app/auth/login/login.component.html
@@ -11,7 +11,7 @@
-