Skip to content

Commit bbe2e90

Browse files
committed
minor #11888 Fixed subscribe JWT claim parameter (dekamaru)
This PR was submitted for the 4.3 branch but it was merged into the 4.2 branch instead (closes #11888). Discussion ---------- Fixed subscribe JWT claim parameter If you follow current 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 it by decoding JWT in these official examples: 1. https://github.com/dunglas/mercure/blob/master/examples/publisher-php.php 2. https://github.com/dunglas/mercure/blob/master/hub/authorization_test.go Commits ------- c089b6e Fixed subscribe claim parameter set
2 parents a2a60f4 + c089b6e commit bbe2e90

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mercure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ And here is the controller::
400400
$username = $this->getUser()->getUsername(); // Retrieve the username of the current user
401401
$token = (new Builder())
402402
// set other appropriate JWT claims, such as an expiration date
403-
->set('mercure', ['subscribe' => "http://example.com/user/$username"]) // could also include the security roles, or anything else
403+
->set('mercure', ['subscribe' => ["http://example.com/user/$username"]]) // could also include the security roles, or anything else
404404
->sign(new Sha256(), $this->getParameter('mercure_secret_key')) // don't forget to set this parameter! Test value: aVerySecretKey
405405
->getToken();
406406

0 commit comments

Comments
 (0)