From c089b6e647ea24e92bd5a9e31f53674c7dccbbfa Mon Sep 17 00:00:00 2001 From: Dmitriy Date: Thu, 4 Jul 2019 16:13:00 +0300 Subject: [PATCH] Fixed subscribe claim parameter set If you follow this guide and set claim mercure `subscribe` with single string - you get following error from mercure: `json: cannot unmarshal string into Go struct field mercureClaim.subscribe of type []string` Subscribe parameter is array, not single string. You can verfiy this in official example: https://github.com/dunglas/mercure/blob/master/examples/publisher-php.php Just decode `DEMO_JWT` and see content --- mercure.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mercure.rst b/mercure.rst index 5f7da4bb177..57215868496 100644 --- a/mercure.rst +++ b/mercure.rst @@ -400,7 +400,7 @@ And here is the controller:: $username = $this->getUser()->getUsername(); // Retrieve the username of the current user $token = (new Builder()) // set other appropriate JWT claims, such as an expiration date - ->set('mercure', ['subscribe' => "http://example.com/user/$username"]) // could also include the security roles, or anything else + ->set('mercure', ['subscribe' => ["http://example.com/user/$username"]]) // could also include the security roles, or anything else ->sign(new Sha256(), $this->getParameter('mercure_secret_key')) // don't forget to set this parameter! Test value: aVerySecretKey ->getToken();