Unable to Authenticate with JWT

Hi, we want to authenticate with JWT, we are working with laravel and it is not working, always return 401.

<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use Illuminate\Support\Facades\Http;
use \Illuminate\Support\Facades\Log;
use \Illuminate\Support\Facades\DB;
use Firebase\JWT\JWT;
use Firebase\JWT\Key;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Str;
class RequestController extends Controller
{
    public function hacerPeticionPost(Request $request)
{
    // return  $request->input('field_name'); --> Solo un valor 
    //Log::info('Request: '.$request);


    Log::info('clientKey: ' .$request);
    $clientKey = $request['clientKey'];
    $publicKey = $request['sharedSecret'];
    $urlBase = $request['baseUrl'];

    $results = DB::select('select * from jirainstallations');
    //Log::info($results);

    try {
        $created = DB::table('jirainstallations')->insert(
            ['clientkey' => $clientKey, 'publickey' => $publicKey, 'urlbase' => $urlBase]
        );

        Log::info("Se ha creado: ");
        Log::info($created);
    } catch (\Exception $e){
        Log::info("Error");
        Log::info($e);
    }




    //Obtenemos la primera carga de datos de Issues
    $issuedAt = (int)(microtime(true) / 1000);
    $expiresAt = $issuedAt + 180;
    $method = "GET";
    $apiPath = "rest/api/3/issue/BDH-1";
    $contextPath = "/";

    $key = "larabelFran";

    $jwtBuilder = [
        'iat' => $issuedAt,
        'exp' => $expiresAt,
        'iss' => $key,
        "qsh" => hash("sha256", "$method&$apiPath&$contextPath")
        ];


    //Log::info('Aqui funciona ');
    //Log::info($payload);
    Log::info("key: ".$publicKey);
    $jwt = JWT::encode($jwtBuilder, $publicKey,'HS256');
    //$jwt = JWT::encode($header,$payload,$key,"HS256");
    Log::info('JWT encodedado: '.$jwt);

    // Obtener la ruta del certificado SSL desde la variable de entorno
    //$cert_path = env('JIRA_SSL_CERT');
    $client = new Client();
    
    $res = $client->request('GET', $urlBase.'/rest/api/3/issue/BDH-1', [
        'headers' => [
            'Authorization' => 'JWT ' . $jwt,
            'Content-Type' => 'application/json'
        ]
    ]);

    $responseBody = $res->getBody();
    Log::info($responseBody);

    return $request->all();
}
}

and this is my connect.json

{
    "key": "larabelFran",
    "baseUrl": "https://plugin.inlogiq.com/",
    "name": "larabelFran",
    "authentication": {
      "type": "jwt"
    },
    "lifecycle": {
      "installed": "/api/hacer-peticion-post",
      "uninstalled": "/uninstalled"
    },
    "modules" : { 
      "webItems": [
        {
          "location": "system.top.navigation.bar",
          "weight": 200,
          "styleClasses": [
            "webitem",
            "system-present-webitem"
          ],
          "url": "/holamundo",
          "context": "addon",
          "tooltip": {
            "value": "Example tooltip"
          },
          "icon": {
            "width": 16,
            "height": 16,
            "url": "/icons/zeus.png"
          },
          "name": {
            "value": "Hola mundo"
          },
          "key": "web-item-example"
        }
      ]
    
    },
    "scopes": ["READ", "ADMIN"]
}

After hours of investigation we solve the problem.

First of all we could not do the call from the installtion call, we need to do other call. Alse, we need to generate the QSH on the call, so in this form we authenticate the call