Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authToken = null in springboot despite set by the client #4972

Open
deepto123 opened this issue Mar 12, 2024 · 1 comment
Open

authToken = null in springboot despite set by the client #4972

deepto123 opened this issue Mar 12, 2024 · 1 comment
Labels
question Further information is requested

Comments

@deepto123
Copy link

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

@deepto123 deepto123 added the to triage Waiting to be triaged by a member of the team label Mar 12, 2024
@darrachequesne
Copy link
Member

Hi! The auth payload may not be supported by your server. Which version are you using?

@darrachequesne darrachequesne added question Further information is requested and removed to triage Waiting to be triaged by a member of the team labels Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants