Skip to content

Commit

Permalink
fix(dbAuth): Correct hardcoded DB column (#9788)
Browse files Browse the repository at this point in the history
**Problem**
Logging in with webauthn enabled was broken when you had customised your
schema to use different column names than the default.

See #8743 for details. 

**Changes**
1. Alters the where clause to use the same column names as the create a
few lines below. See:
https://github.com/redwoodjs/redwood/blob/c7ae669e36c5e1b7edcd4ee5436558831bad94b8/packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts#L979-L983

**Fixes**
Fixes #8743
  • Loading branch information
Josh-Walker-GM authored and jtoar committed Jan 3, 2024
1 parent d5d125c commit 91d0f06
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/auth-providers/dbAuth/api/src/DbAuthHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -972,8 +972,9 @@ export class DbAuthHandler<

const existingDevice = await this.dbCredentialAccessor.findFirst({
where: {
id: plainCredentialId,
userId: user[this.options.authFields.id],
[this.options.webAuthn.credentialFields.id]: plainCredentialId,
[this.options.webAuthn.credentialFields.userId]:
user[this.options.authFields.id],
},
})

Expand Down

0 comments on commit 91d0f06

Please sign in to comment.