fix(hermes): support Socket.IO handshake auth#1487
Conversation
…ents Bridge handshake.auth token fields to Authorization header in namespace middleware so browser websocket-first connections can authenticate without polling + extraHeaders.
Connect, event, and disconnect handlers read auth from socket.data after namespace middleware, not socket.request.conduit.
Keep websocket-first socket authentication explicit to bearer fields. Preserve existing transport headers and ignore socket cookies.
Review Notes1. Token precedence is silently lossyIn const rawToken = auth.token ?? auth.accessToken;
if (rawToken && !hasAuthorizationHeader) {
headers.authorization = `Bearer ${rawToken}`;
}
if (typeof auth.authorization === 'string' && !hasAuthorizationHeader) {
headers.authorization = auth.authorization;
}If a client sends 2. Behavioral change: event handlers now receive post-middleware contextPreviously, |
Summary
handshake.authtoken fields into Hermes socket middleware headers so browser websocket-first clients can authenticate without pollingextraHeaders.Authorizationheaders, ignore socket cookies, and passsocket.datacontext to socket handlers on main.Test plan
cd libraries/hermes && pnpm test