Skip to content

Commit

Permalink
Better error handling on processing authentication token
Browse files Browse the repository at this point in the history
  • Loading branch information
aminlatifi committed Oct 11, 2024
1 parent 895dda5 commit 4ded653
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/server/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,10 @@ export async function bootstrap() {
const { headers } = req;
const authVersion = headers?.authversion || '1';
if (headers?.authorization) {
token = headers.authorization.split(' ')[1].toString();
token = headers.authorization?.split(' ')[1].toString();
if (!token) {
throw new Error('Authorization token is missing');
}
user = await authorizationHandler(authVersion as string, token);
}
}
Expand Down

0 comments on commit 4ded653

Please sign in to comment.