socketcluster-client-java icon indicating copy to clipboard operation
socketcluster-client-java copied to clipboard

connect with auth - error

Open aviolide opened this issue 6 years ago • 3 comments

try connect with apikey and apisecret to wss://sc-02.coinigy.com/socketcluster/. in Socket.java change connection code -

            `JSONObject handshakeObject=new JSONObject();
            handshakeObject.put("event","#handshake");

            JSONObject obj = new JSONObject();
            obj.put("apiKey", "api");
            obj.put("apiSecret", "secret");

            JSONObject object=new JSONObject();
            object.put("authToken",obj.toString());
            handshakeObject.put("data",object);
            handshakeObject.put("cid",counter.getAndIncrement());
            websocket.sendText(handshakeObject.toString());`

and return - {"authError":{"name":"AuthTokenInvalidError","message":"jwt malformed"},"pingTimeout":20000,"id":"v45cx9vKX-xQXD1BAGmo","isAuthenticated":false} as i understand - it because the authtoken dont encode by jwt, can u provide the sample of working code with api auth?

aviolide avatar Mar 11 '18 17:03 aviolide

i find the issue. the library is not designed to make secure connection. api and secret must be encoded with JWT. but if you do the correct auth, the async between request is broken

aviolide avatar Mar 13 '18 09:03 aviolide

Hi @desided , Can you please take a look here for solution https://github.com/sacOO7/socketcluster-client-java/issues/17. I am pretty sure it is supposed to work. Please let me know if you have any other issues. If you are facing any other problem, I will directly put working code in here....

sacOO7 avatar Mar 17 '18 15:03 sacOO7

HI @desided , the issue is probably due to coinigy server problem. They have shut it down due to some load balancing issues. You will find more details here Coinigy/api#34

sacOO7 avatar Jun 01 '18 17:06 sacOO7