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 committed Jan 2, 2024
1 parent 90d83aa commit ebee4b6
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 @@ -970,8 +970,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 ebee4b6

Please sign in to comment.