Skip to content

Commit

Permalink
fix: project id bearer
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelwt committed Feb 19, 2024
1 parent aba3fa0 commit 88531a8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions packages/backend/src/api/v1/auth/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,14 @@ export async function authMiddleware(ctx: Context, next: Next) {

const bearerToken = ctx.request?.headers?.authorization?.split(" ")[1]

if (isPublicRoute && (!bearerToken || validateUUID(bearerToken))) {
if (isPublicRoute) {
if (validateUUID(bearerToken)) {
ctx.state.projectId = bearerToken as string
}
await next()
return
}

if (isPublicRoute) {
const bearerToken = ctx.request?.headers?.authorization?.split(" ")[1]

if (typeof bearerToken === "string") {
ctx.state.projectId = bearerToken
}
await next()
return
}

try {
if (!bearerToken) {
throw new Error("No bearer token provided.")
Expand Down

0 comments on commit 88531a8

Please sign in to comment.