How do i send the authorization headers back to the server from IOS.
Currently I'm using socket.io-jwt to check the authorization back in the server.
Because I would only get the token when the user logs in.
How would I approach this problem?
In the documentation for the website, it shows
var socket = io.connect('http://localhost:9000', {
'query': 'token=' + your_jwt
});
How would I append the token into the connection?
This is what I did
let keychain = Keychain(server: "https://testing.herokuapp.com", protocolType: .HTTPS)
var token: String {
get {
return String(keychain["token"])
}
}
//
lazy var socket: SocketIOClient = SocketIOClient(socketURL: NSURL(string: "https://testing.herokuapp.com")!,
options: [.Log(true), .ExtraHeaders(["Authorization": "Basic \(self.token)", "Accept":"application/json"]) ])
But seems like it doesn't work.
how to send authorisation headers when using socket.io