Skip to content

Commit ff3c273

Browse files
authored
fix: agent auth issue due to incorrect token (#1388)
Signed-off-by: Krishna Waske <[email protected]>
1 parent 732ac88 commit ff3c273

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/agent-service/src/agent-service.service.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1748,7 +1748,6 @@ export class AgentServiceService {
17481748
throw new InternalServerErrorException(`Failed to get agent information: ${orgAgentResult.reason}`);
17491749
}
17501750

1751-
const getApiKey = getApiKeyResult?.value;
17521751
const orgAgent = orgAgentResult?.value;
17531752

17541753
const orgAgentTypeResult = await this.agentServiceRepository.getOrgAgentType(orgAgent.orgAgentTypeId);
@@ -1757,6 +1756,17 @@ export class AgentServiceService {
17571756
throw new NotFoundException(ResponseMessages.agent.error.orgAgentNotFound);
17581757
}
17591758

1759+
let getApiKey;
1760+
if (OrgAgentType.SHARED) {
1761+
const platformAdminSpinnedUp = await this.agentServiceRepository.platformAdminAgent(
1762+
CommonConstants.PLATFORM_ADMIN_ORG
1763+
);
1764+
1765+
getApiKey = await this.commonService.decryptPassword(platformAdminSpinnedUp?.org_agents[0].apiKey);
1766+
} else {
1767+
getApiKey = getApiKeyResult?.value;
1768+
}
1769+
17601770
// Determine the URL based on the agent type
17611771
const url =
17621772
orgAgentTypeResult.agent === OrgAgentType.SHARED

0 commit comments

Comments
 (0)