PHP code example of hashandsalt / kirby3-auth0

1. Go to this page and download the library: Download hashandsalt/kirby3-auth0 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/ */

    

hashandsalt / kirby3-auth0 example snippets


$auth0 = site()->auth0();
$session = $auth0->getCredentials();
$user = $session === null ? null : $session->user;

if (is_null($user)) {
  echo 'You are not logged in</br>';
  echo '<p>Please <a href="/login">log in</a>.</p>';
} else {
  $name = $user['given_name'] ?? $user['nickname'] ?? $user['email'] ?? 'Unknown';
  echo '<h1>Welcome '  . $name . '!</h1>';
  echo '<p><a href="/logout">log out</a>.</p>';
}

'hashandsalt.auth0.baseUri' => 'https://localhost:3000/', // set to your live domain name on the public server
'hashandsalt.auth0.env' => './',