Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: identityAccessTokenDALFactory.findOne dal function

Piyush Guptaa76e323b6cf4
diff --git a/backend/src/services/identity-access-token/identity-access-token-dal.ts b/backend/src/services/identity-access-token/identity-access-token-dal.ts
index ffdb786459..74b624a7e1 100644
--- a/backend/src/services/identity-access-token/identity-access-token-dal.ts
+++ b/backend/src/services/identity-access-token/identity-access-token-dal.ts
@@ -18,7 +18,6 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
.where(filter)
.join(TableName.Identity, `${TableName.Identity}.id`, `${TableName.IdentityAccessToken}.identityId`)
.select(selectAllTableCols(TableName.IdentityAccessToken))
- .select(db.ref("name").withSchema(TableName.Identity))
.select(db.ref("orgId").withSchema(TableName.Identity).as("identityScopeOrgId"))
.first();
diff --git a/backend/src/services/identity-token-auth/identity-token-auth-service.ts b/backend/src/services/identity-token-auth/identity-token-auth-service.ts
index 1ece312ea6..97717c4f31 100644
--- a/backend/src/services/identity-token-auth/identity-token-auth-service.ts
+++ b/backend/src/services/identity-token-auth/identity-token-auth-service.ts
@@ -535,7 +535,11 @@ export const identityTokenAuthServiceFactory = ({
});
ForbiddenError.from(permission).throwUnlessCan(OrgPermissionIdentityActions.Read, OrgPermissionSubjects.Identity);
- const token = await identityAccessTokenDAL.findById(tokenId);
+ const token = await identityAccessTokenDAL.findOne({
+ [`${TableName.IdentityAccessToken}.id` as "id"]: tokenId,
+ [`${TableName.IdentityAccessToken}.authMethod` as "authMethod"]: IdentityAuthMethod.TOKEN_AUTH,
+ [`${TableName.IdentityAccessToken}.identityId` as "identityId"]: identityId
+ });
if (!token) throw new NotFoundError({ message: `Token with ID ${tokenId} not found` });