At the beginning a little errata to part 1
We used before as JWT_KEY a certificate.
I found a problem to generate working JWT token.
If somebody make it working please let me know.
New files:
- Lets generate 256-bit key (JWT_KEY) and use this key in our mercure.yaml config file
- Next step would be to generate JWT_TOKEN at jwt.io with below params
-
header - this is default for mercure (you can use different but it requires specific configuration)
{ "alg": "HS256", "typ": "JWT" } -
payload
{ "mercure": { "publish": [] } } - your-256-bit-secret - use the JWT_KEY generated before
- copy and keep generated token from left top window called Encoded
-
header - this is default for mercure (you can use different but it requires specific configuration)
- replace previous file
/etc/mercure/mercure.yamlwith new one and update it with JWT_KEY generated above - replace previous file
/etc/systemd/system/mercure.servicewith the new one and runsudo systemctl daemon-reloadsudo systemctl restart mercure.service
- now you have mercure server working
again but this time we shall be able to talk to it - simple test to check if everything is OK test-rocks.sh just replace JWT_TOKEN with your token, when you run it in console you will see returned UUID.
If you want to see it on web browser use - and check results in browser and browser console.
If you see at any stage Unauthorized that means there is something wrong
and I think you should restart the fight ![]()
What doesn’t kill you makes you stronger. Don’t give up. ![]()
In the next part I think to do a chat app (don’t know when yet). Stay tuned.