Skip to content

Integrating with PHP API

Terminal window
composer require authaction/authaction-php-sdk
use AuthAction\AuthAction;
$aa = new AuthAction($_ENV['AUTHACTION_DOMAIN'], $_ENV['AUTHACTION_AUDIENCE']);
// Verify from Authorization header — returns null on missing/invalid
$user = $aa->verifyRequest($_SERVER['HTTP_AUTHORIZATION'] ?? null);
if (!$user) { http_response_code(401); exit; }
echo json_encode(['sub' => $user->sub]);

Full SDK reference: github.com/authaction/authaction-php-sdk