Search code examples
javascriptgoogle-chromefido-u2f

using u2f-api.js Client Side Test


I'm trying to show the registration response from a Fido U2F token on an alert (Google chrome V41) like so:

<script src="/u2f-api.js"></script>
<script>
var challenge = {
        version : "U2F_V2",
        challenge : "YXJlIHlvdSBib3JlZD8gOy0p",
        appId : "/index.html",
        sessionId : "26"
    };

u2f.sign([challenge], [],
  function(deviceResponse) {
    alert(JSON.stringify(deviceResponse));
  }
);
</script>

but for some reason this code doesn't work correctly. I don't see the alert even after clicking on the token button.


Solution

  • I've resolved this I forgot the " . " in u2f-api.js url

    <script src="./u2f-api.js"></script>