if (json_last_error() == JSON_ERROR_NONE) {
mylog('Returning the challenge: ' . $data->challenge);
echo rawurlencode($data->challenge);
exit;
}
Forgot that json_decode makes a object not an array by default
tested the script with TwitchCLI both to verify and recv a payload and it seems to be behaving as required now