github / webauthn-json

🔏 A small WebAuthn API wrapper that translates to/from pure JSON using base64url.
https://github.github.com/webauthn-json/demo/
MIT License
760 stars 61 forks source link

Chrome not using displayName to name the Passkey #88

Closed WatameBytes closed 3 months ago

WatameBytes commented 3 months ago

The object I get back from my backend is as follows.

{
    "publicKeyCredentialCreationOptions": {
        "user": {
             "name": "Some_User_Id", // Currently uses this to name the Passkey
             "displayName: "Username", // I want this to appear on Chrome name after we create a Passkey
             "id": "some_id"
         }
         ...
}

Frontend code

const response = await fetch(...)

const data = await response.json()
const options = {publicKey: data.publicKeyCredentialCreationOptions};
const credential = await webauthnJson.create(options)

For some reason, it uses the name field to name the Passkeys on Chrome Passkeys. I was wondering if there was a way to make it use the displayName, so it's actually readable.

A mino-workaround was to do the following

data.publicKeyCredentialCreationOptions.user.name = data.publicKeyCredentialCreationOptions.user.displayName

But that is so janky and I feel like that isn't correct.

lgarron commented 3 months ago

Forgive me if I'm missing something, but this doesn't seem like something this project can address?

You could comment on https://github.com/w3c/webauthn/issues/1852 if you think this needs a spec or ecosystem change.

WatameBytes commented 3 months ago

Thank you, just needed confirmation this isn't something we, mostly you, can't control.