WebAuthn icon indicating copy to clipboard operation
WebAuthn copied to clipboard

Public Key and Certificate Always Different

Open madzae opened this issue 4 years ago • 1 comments

Hey,

With example code, I can generate credentialId, credentialPublicKey, and certificate from PHP Session ($_SESSION['registrations']) and save that data to MySQL database. But, everytime the user logout and login again, the credentialId, credentialPublicKey, and certificate not the same as the previous ones.

This sample code from my project to get the data from PHP Session.

<?php

foreach ($_SESSION['registrations'] as $obj)
{
   
    echo $obj->credentialPublicKey;
    echo "<br>";
    echo $obj->certificate;
    echo "<br>";
    echo $obj->credentialId;

}

My question is, how to authenticate user with that data?

madzae avatar Jul 29 '21 07:07 madzae

you should only generate one registration, it's not possible to compare different registrations. For verification, there is another function. check out workflow and sample code at https://github.com/lbuchs/WebAuthn/blob/master/_test/server.php.

lbuchs avatar Aug 02 '21 12:08 lbuchs