Piotr Synowiec
Piotr Synowiec
1 min read

Categories

Tags

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:

  1. Lets generate 256-bit key (JWT_KEY) and use this key in our mercure.yaml config file
  2. 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
  3. replace previous file /etc/mercure/mercure.yaml with new one and update it with JWT_KEY generated above
  4. replace previous file /etc/systemd/system/mercure.service with the new one and run
    • sudo systemctl daemon-reload
    • sudo systemctl restart mercure.service
  5. now you have mercure server working :wink: again but this time we shall be able to talk to it
  6. 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 :disappointed: and I think you should restart the fight :muscle:
What doesn’t kill you makes you stronger. Don’t give up. :fist:

In the next part I think to do a chat app (don’t know when yet). Stay tuned.