Skip to content

Commit

Permalink
Introduce Auth Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Jan 1, 2022
1 parent 81e10a3 commit f53cc23
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/auth/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const useAuth: RequestHandler = NextHandler(
auth = auth.slice(0, Math.max(0, 'Bearer '.length));
}

log.debug('Validating ' + auth);

const decoded = decode(auth) as { account: string; value: number };

if (!decoded) return NoPermission();
Expand All @@ -36,7 +38,7 @@ export const useAuth: RequestHandler = NextHandler(
if (key.owner_id.toString() !== decoded.account) return NoPermission();

request.auth = {
user_id: key.owner_id
user_id: key.owner_id,
};
log.network('Verified Auth for user ' + key.owner_id);
}
Expand Down

0 comments on commit f53cc23

Please sign in to comment.