Skip to content

Commit

Permalink
Now removing the auth0| prefix from user id.
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleydavis committed Apr 13, 2024
1 parent 940c9b2 commit 146d2c2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion backend/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ export async function createServer(now: () => Date, assetDatabase: IAssetDatabas
return;
}

const userId = (req.auth.payload.sub!).replace("|", "-");
let userId = req.auth.payload.sub;
if (userId.startsWith("auth0|")) {
// Removes the auth0| prefix the user id.
userId = userId.substring(6);
}
const user = await userDatabase.getOne(`users`, userId);
if (!user) {
res.sendStatus(401);
Expand Down

0 comments on commit 146d2c2

Please sign in to comment.