1. Go to this page and download the library: Download authwave/php-client 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/ */
authwave / php-client example snippets
use Authwave\Authenticator;
use Authwave\AuthUser;
Y");
if($clientKey === false || $clientKey === "") {
throw new RuntimeException("Set AUTHWAVE_CLIENT_KEY before running the application.");
}
$auth = new Authenticator(
clientKey: $clientKey,
currentUriPath: $_SERVER["REQUEST_URI"],
onAuthenticated: function(AuthUser $user):void {
error_log("Authentication completed for user " . $user->id);
},
);
if(isset($_GET["login"])) {
$auth->setReturnUri("/");
$auth->login();
}
if($auth->isLoggedIn()) {
$user = $auth->getAuthUser();
$email = htmlspecialchars($user->email, ENT_QUOTES, "UTF-8");
echo "<p>You are logged in as <strong>$email</strong>.</p>";
}
else {
echo '<p><a href="?login">Log in</a></p>';
}