Jwt verify in php

Use a library GitHub - firebase/php-jwt: PHP package for JWT

A snippet from an older EBS (older as in I don’t use it anymore)

$secret = base64_decode(LIVE_EXTENSION_SECRET);

include(__DIR__ . '/lib/jwt.php');
$j = new JWT();

try {
    $res = $j->decode($token, $secret);
} catch (Exception $e) {
    $output['error'] = 'J An Error Occured';
    $output['error'] = $e->getMessage();
    echo json_encode($output);
    exit;
}

$opaque = $res->opaque_user_id;
$permissions = $res->pubsub_perms;
$channel_id = $res->channel_id;

This snippet may not longer be valid since my copy of the library is from 2017, and the github repo I linked has a much newer/changed version.