Skip to content

Commit

Permalink
feat: remove auth token validation and use just admin and store token
Browse files Browse the repository at this point in the history
  • Loading branch information
Rudge committed Dec 14, 2023
1 parent 10a8fc2 commit e98efe3
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions node/directives/checkUserAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export async function checkUserOrAdminTokenAccess(
operation?: string
) {
const {
vtex: { adminUserAuthToken, storeUserAuthToken, logger, authToken },
vtex: { adminUserAuthToken, storeUserAuthToken, logger },
clients: { identity, vtexId },
} = ctx

if (!adminUserAuthToken && !storeUserAuthToken && !authToken) {
if (!adminUserAuthToken && !storeUserAuthToken) {
logger.warn({
message: `CheckUserAccess: No admin or store token was provided`,
operation,
Expand Down Expand Up @@ -55,16 +55,6 @@ export async function checkUserOrAdminTokenAccess(
if (!authUser) {
throw new ForbiddenError('Unauthorized Access')
}
} else if (authToken) {
try {
await identity.validateToken({ token: authToken })
} catch (err) {
logger.warn({
error: err,
message: 'CheckUserAccess: Invalid admin token',
})
throw new ForbiddenError('Unauthorized Access')
}
}
}

Expand Down

0 comments on commit e98efe3

Please sign in to comment.