PHP code example of ovenlab / cakephp-passkey

1. Go to this page and download the library: Download ovenlab/cakephp-passkey library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ovenlab / cakephp-passkey example snippets


// src/Application.php
public function bootstrap(): void
{
    parent::bootstrap();
    $this->addPlugin('Passkey');
}

// config/passkey.php
return [
    'Passkey' => [
        'rp' => [
            'name' => 'My App',            // shown by the authenticator UI
            'id' => env('PASSKEY_RP_ID'),  // registrable domain, e.g. "example.com"
        ],
        'origin' => env('PASSKEY_ORIGIN'), // e.g. "https://example.com"
        'userVerification' => 'preferred', // 'in
        'userField' => 'id',               // field matched against the credential owner
        'displayNameField' => 'username',  // shown by the authenticator during registration
    ],
];

// in a template — loads webroot/js/passkey.js
<?= $this->Passkey->script()