I have searched through both stack overflow and google for the past few days with regards to this issue.
I am trying to connect to a 3rd party API therefore do not have access to or visibility of the websocket server.
I am able to connect to the OAuth endpoint and return a valid Access token however i am unable to pass this access token via socket.io-clients io.connect method without the access token being urlencoded.
Code that i am using to access the endpoint (with expired, but was valid, access token)
serviceEndpoint = "/uapi/ws/" + sha1(appId + accessToken) + "/" + instanceId + "/";
socket = io.connect(host, {
transports: ['websocket'],
path: serviceEndpoint,
query: "access_token=1|5-zURhzg6X-vEWUwqBM~b9D0vqHJ-bBR|211|1455710158|7-ykMSvs07-w13mfhpf.CBNJEmmH.GY5"
});
When getting the error back from the server (401) the url that is being requested has the following string for access_token:
access_token=1%7C5-zURhzg6X-vEWUwqBM~b9D0vqHJ-bBR%7C211%7C1455710158%7C7-ykMSvs07-w13mfhpf.CBNJEmmH.GY5
As you can see all of the pipe (|) characters have been encoded which is causing the token to be discarded by the server.
- Is there a way to stop the query string from being urlencoded?
- If not, is there a way to POST this parameter using socket.io-client?