From 96b4d5e14a5e994c9ee48eb7b659f671b6967099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dursus?= Date: Sat, 23 Jan 2021 20:56:01 +0100 Subject: [PATCH] Adding Base64 decoding of the secret The example does not work if the user does not first decode the secret token with Base64 (wich is not specified if i'm not mistaken) --- services/backend.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/backend.js b/services/backend.js index 3fcdcc5..d2bf38c 100644 --- a/services/backend.js +++ b/services/backend.js @@ -250,7 +250,7 @@ function makeServerToken(channelId) { send: ['*'], }, }; - return jsonwebtoken.sign(payload, secret, { algorithm: 'HS256' }); + return jsonwebtoken.sign(payload, Buffer.from(secret, "base64"), { algorithm: 'HS256' }); } function userIsInCooldown(opaqueUserId) {