Skip to content

Commit

Permalink
Simplify WebAuthn configuration URL parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
kentcdodds committed Feb 7, 2025
1 parent 8084c0e commit 183c1a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/utils/webauthn.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export const RegistrationResponseSchema = z.object({
}) satisfies z.ZodType<RegistrationResponseJSON>

export function getWebAuthnConfig(request: Request) {
const domain = new URL(getDomainUrl(request)).hostname
const url = new URL(getDomainUrl(request))
return {
rpName: `KCD (${domain})`,
rpID: domain,
origin: new URL(request.url).origin,
rpName: `KCD (${url.hostname})`,
rpID: url.hostname,
origin: url.origin,
// Common options for both registration and authentication
authenticatorSelection: {
residentKey: 'preferred',
Expand Down

0 comments on commit 183c1a8

Please sign in to comment.