Closed Alex-Catchpole closed 9 years ago
Have you tried
var sockett = SocketIOClient(socketURL: "192.168.0.3:8000", opts: ["connectParams": ["token": "\(token)"]])
@Alex-Catchpole does ^ work
This is also not working for me. Tried "connectParams" and nothing seems to come through at all.
This is working for me. We're using the Objective-C convenience method.
self.socket = [[SocketIOClient alloc] initWithSocketURL:@"http://localhost/" options:@{@"connectParams": @{@"foo": @"bar", @"this": @"that"}}
On the server, I see (in socket.request):
_query:
{ transport: 'polling',
foo: 'bar',
this: 'that',
b64: '1' },
@markschmid +1. Worked for me too!
@Alex-Catchpole I have the same issue, Is working to some one?? @markschmid Did you try on Swift if this work I have this code and is not working
public var socket = SocketIOClient(socketURL: "develop.test.com:9000", options: ["log": true,"connectParams": ["token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1dWlkIjoiOTllZDUxM2UtZGZhOS00ODU4LWJlYTItODg5MDgxZTUxYzk0Iiwic2VjcmV0IjoiOTQyYmQzYTliYzkxMTBkZTcyZmQwYmUyMzRiNDlhMzUzM2M0MGEwNGFmMTJkNTI0ODYzYmYwNDdhYWJlZjY5ZTBjNTQ3YTljNWNiMDA4MTI3ODBkMmMzNWEwNDJlNTg3In0.6UC_P09W0-mcztRNQpPXep-k8knS5JE1AjSJIY70_C0"]])
I'm trying to use JSON web tokens to authenticate my socket.io connection. To do this i'm using this:
https://github.com/auth0/socketio-jwt
This requires I send the token in the connection params when I connect to my socket.io server. This isn't working even though I believe I'm doing everything right. The problem is client side on the app.
It appears the params are never being sent. I always receive the error event which tells me I have not sent the headers required (the token)
I believe I am sending the parameters correctly but feel free to correct me if I'm doing something wrong.