I currently develop a realtime kik connector for the unification engine.
To receive the messages, I connect to the websocket endpoint using my users name and password.
Sadly, I get an error 403 everytime.
Is there anything else I have to look out for?
Some examples:
$ curl -XPOST https://apiv2.unificationengine.com/v2/connection/list -u $USER_NAME:$PASSWORD --data "{}" -k -s | jq
{
"status": 200,
"info": "200 OK",
"connections": {
"kik": {
"uri": "kik://kik_user@kik.com"
}
}
}
Websocket:
$ wscat --auth "$USER_NAME:$PASSWORD" -c wss://apiv2.unificationengine.com/v2/ws/start
error: Error: unexpected server response (403)
Are you using this library? https://github.com/websockets/wscat
Does this library support authentication in this way?
wscat --auth "$USER_NAME:$PASSWORD" -c wss://apiv2.unificationengine.com/v2/ws/start
Done research on this, wscat is using npm ws, https://github.com/websockets/ws for webscoket connection.
Can you try header like this and check
var ws = new WebSocket('wss://apiv2.unificationengine.com/v2/ws/start', {
origin: 'https://apiv2.unificationengine.com',
headers: { Authorization: 'base64 auth' }
});
You can create base64 auth like this in nodejs
var auth = "Basic " + new Buffer(USER_ACCESS_KEY + ":" + USER_ACCESS_SECRET).toString("base64");