authToken = null in springboot despite set by the client
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 63.2k
- Forks
- 10.3k
- Avg merge
- 11d 20h
- Merged PRs (30d)
- 2
Description
Describe the bug
Im setting up the server in my springboot application and nodejs application (not simaltaneously) both and my client in nodejs.
When I set the auth token on my client(in node application) and server is also in node it works fine and the authToken object is found in the handshake but if I run the server in my springboot application, authToken object is null.
To Reproduce
Please fill the following code example:
Server
socketIOServer.addConnectListener(new ConnectListener() {
@Override
public void onConnect(SocketIOClient client) {
Object jwtToken = client.getHandshakeData().getAuthToken(); // null here
}
}
Socket.IO client version: x.y.z
Client
const io = require('socket.io-client');
// Connect to the server with custom headers
const socket = io('http://localhost:8081', {
auth: {token: 'eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0LGpvaG5kb2VAZXhhbXBsZS5jb20iLCJpYX' },
});
// Handle connection event
socket.on('connect', () => {
console.log('Connected to server');
});
// Handle custom events from the server
socket.on('message', (data) => {
console.log('Received message from server:', data);
});
// Emit custom events to the server
socket.emit('chatMessage', 'Hello, server!');
Expected behavior
Expect springboot tocatch the authToken in handshake
Platform:
-MacOs
Additional context
Query params when set are being properly found in url params of the handshake, but authtoken isnt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Spring Boot connect listener and the Node.js client's io auth option, then compare how the handshake data is handled on each server implementation. The issue is resolved when the token sent in auth is available through the Spring Boot server's handshake data, with the relevant client and server versions documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, spring-boot
- Domain
- api, authentication, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100