laravel-webauthn icon indicating copy to clipboard operation
laravel-webauthn copied to clipboard

Getting "Error during the validation of the key". how do i debug this?

Open safjammed opened this issue 2 years ago • 4 comments

I have implemented the solution using jquery. I have followed the test app that is provided with the readme.

here's my code:

window.webauthn = new WebAuthn((name, message) => {
           console.log({name, message});
});

$("#add-webauth").click(function(){
        $.post(route('webauthn.store.options'), {}).done(({publicKey}) =>  {
            console.log("publicKey", publicKey);
            window.webauthn.register(
                publicKey,
                (data) => {
                    const payload = {
                        ...data,
                        name:`${device.brand} ${os.name} on ${client.name}`,
                    };
                                console.log("DATA", {payload});
                    $.post(route('webauthn.store'), payload).done(resp =>    console.log("STORE", {resp}));
                }
            );
        });
    });
{"message":"The given data was invalid.","errors":{"email":["Error during the validation of the key"]}}

Please help!

safjammed avatar Mar 28 '22 00:03 safjammed

Did you look at the browser debug tool and/or network logs? Especially the POST raw return?

asbiin avatar May 06 '22 18:05 asbiin

Did you solve this? My Error {"message":"Error during the validation of the key","errors":{"email":["Error during the validation of the key"]}}

ssgnoe avatar Jun 10 '22 15:06 ssgnoe

@ssgnoe, Our team ended up abandoning the feature for the client since it's too much hassle and we might be incompetent. The thing is it works on the example laravel @asbiin provided, so it must be something we did that caused this. There's a very little debugging..

I urge @asbiin to utilize laravel logging. So that we can debug this. You may also add logging switch in the config file or check if the app has debugging mode enabled.

I cant really suggest anything, other than start with @asbiin 's provided laravel example, build your app off of it. Good luck!

safjammed avatar Jun 10 '22 20:06 safjammed

@safjammed Hey, Thanks for your help. Unfortunately the demo Repository also doesn't work on my system. On generating key I get an error Bildschirmfoto 2022-06-16 um 15 40 00

I'm not getting the error. useForm().post(route('webauthn.store.options')) is sending the request, so why the browser sends it as a get request?

ssgnoe avatar Jun 16 '22 13:06 ssgnoe

{"message":"The given data was invalid.","errors":{"email":["Error during the validation of the key"]}}

I'm getting this error too if i set attestation_conveyance in the config to indirect/direct/enterprise. If i set it to none (default), it works.

frknakk avatar Apr 06 '23 18:04 frknakk

I highly recommand you to switch to @simplewebauthn/browser which is supported and maintained. It's a better solution as asbiin/laravel-webauthn is not a frontend package.

asbiin avatar Sep 04 '23 20:09 asbiin