Skip to content

Commit

Permalink
fix: unpack userId from JWT payload
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordfirespeed committed Aug 10, 2024
1 parent 30e6679 commit 238953b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/token-vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export class TokenVault<TUser> {
}

public async getUserAndScopeClaims(payload: JWTPayload): Promise<{ user: TUser; scope: string[] }> {
const { user_id, scope } = payload
const { userId, scope } = payload

if (typeof user_id !== "string") {
if (typeof userId !== "string") {
throw new TokenError("Invalid user ID", {
code: "ERR_TOKEN_USER_ID_INVALID"
})
Expand All @@ -89,7 +89,7 @@ export class TokenVault<TUser> {
})
}

const user = await this.findUniqueUser(user_id)
const user = await this.findUniqueUser(userId)
if (user == null)
throw new ModuleError("User not found.", {
code: "ERR_USER_NOT_FOUND",
Expand Down

0 comments on commit 238953b

Please sign in to comment.