-
The error: My program: use Lcobucci\JWT\Signer\Hmac\Sha256;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Builder;
public function chat()
{
$username = $this->getUser()->getUsername();
$token = (new Builder())
->withClaim('mercure', ['subscribe' => [sprintf("/%s", $username)]])
->getToken(
new Sha256(),
new Key($this->getParameter('mercure_secret_key'))
)
;
$response = $this->render('conversacion/index.html.twig', [
'controller_name' => 'UsuarioController'
]);
$response->headers->setCookie(
new Cookie(
'mercureAuthorization',
$token,
(new \DateTime())
->add(new \DateInterval('PT2H')),
'/.well-known/mercure',
null,
false,
true,
false,
'strict'
)
);
return $response;
} |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
You want to |
Beta Was this translation helpful? Give feedback.
-
I might follow the same auto as R3B4T0 because I have the same code but after changed use Lcobucci\JWT\Token\Builder I get : Too few arguments to function Lcobucci\JWT\Token\Builder::__construct(), 0 passed in /Users/thibaudrobillardDesktop/AFPA/lbchat/src/Controller/IndexController.php on line 20 and exactly 2 expected |
Beta Was this translation helpful? Give feedback.
-
You want to this worked |
Beta Was this translation helpful? Give feedback.
You want to
use Lcobucci\JWT\Token\Builder
, notuse Lcobucci\JWT\Builder