javascriptbrowserservercredentialswebauthn

navigator.credentials is null on local server


here is my problem : I try to use the Credential Management API to access to authenticators on my webapp : navigator.credentials.create() and navigator.credentials.get().

I have no problem when I execute my code on localhost, and the webapp is asking for my security key. But when I am on my local server, with the exact same code, navigator.credentials is undefined although I am using the same browser.

Uncaught TypeError: Cannot read property 'create' of undefined

(window.PasswordCredential || window.FederatedCredential) returns false, only on my server 192.168.x.x but I don't know why. I am on Chrome 74.

How could I resolve this problem ?
Thank you for your help.


Solution

  • WebAuthn javascript will work only when used with HTTPS or on the localhost hostname (in this case HTTPS is not required).

    It seems that you are using an IP address.