WS client: Remove trailing `=` from base64-encoded access token (#2976)

Follow-up for #2907.

Fixes WS client broken due to `=` being part of the base74-encoded
token, which is no allowed WS subprotocol value.

Signed-off-by: Florian Hotze <dev@florianhotze.com>
pull/2980/head
Florian Hotze 2025-01-04 18:11:27 +01:00 committed by GitHub
parent 6104cba46d
commit 75e866792a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -10,8 +10,9 @@ const HEARTBEAT_MESSAGE = `{
const openWSConnections = []
function newWSConnection (path, messageCallback, readyCallback, errorCallback, heartbeatCallback, heartbeatInterval) {
const encodedToken = btoa(getAccessToken()).replace(/=*$/, '')
// Create a new WebSocket connection
const socket = new WebSocket(path, [`org.openhab.ws.accessToken.base64.${btoa(getAccessToken())}`, 'org.openhab.ws.protocol.default'])
const socket = new WebSocket(path, [`org.openhab.ws.accessToken.base64.${encodedToken}`, 'org.openhab.ws.protocol.default'])
// Handle WebSocket connection opened
socket.onopen = (event) => {