question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Websocket: cannot subscribe with authentication

See original GitHub issue

Hi!

Without authentication, I can subscribe to GDAX Websocket feed (any channel combination).

Instead, if I set my key, passphrase and secret code, then I get the answer: {"type":"error","message":"Sorry, you could not be authenticated: Bad Request","reason":"invalid signature"}

According to the GDAX api, when specifying channels you must authenticate using the path: "/users/self/verify" (just "/users/self" if you don’t specify channels).

However in signObject() on WebsocketFeed.java, the path is “” as you might find on line 198:

jsonObj.setSignature(signature.generate("", "GET", jsonString, timestamp));

I tried to correct the issue (i.e. setting the correct path), with no success.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
zoltanmajzikcommented, Sep 11, 2019

I managed to solve this issue with the following changes:

Make these changes, then subscribe to user channel, and you are good to go.

0reactions
DBurghardtcommented, Jul 30, 2020

@robevansuk Your code works well for the market data, because it does not need authentication. If you would try to subscribe to the full channel with something like

{“type”:“subscribe”, “channels”:[{“name”:“user”,“product_ids”:[“ETH-DAI”,“ETH-USDC”,“BAT-ETH”]}], “signature”:“<signature>”, “passphrase”:“<phrase>”, “timestamp”:“<tstamp>”, “key”:“<key>” }

you can quickly realize (even after inserting your valid credentials in the above JSON), that upon subscription you will receive:

{“type”:“error”,“message”:“Authentication Failed”,“reason”:“{"message":"invalid signature"}”}

I also had the problems when I started to build an automated java trader, I have checked the code in node.js/javascript-api client to solve this issue and came to the same solution as @zoltanmajzik … and I am running my code with real money since month now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to authenticate connections to websocket gateways
In my use case the client will only be subscribing to messages and not pushing any messages at all. I could call client.disconnect()...
Read more >
html - Websocket authentication - Stack Overflow
I'm running a websocket server and asking myself, if it's planed, that clients authentication will be done with handshake in future... draft xxxx...
Read more >
Subscriptions in Apollo Server - Apollo GraphQL Docs
Enabling subscriptions ; 1. // Creating the WebSocket server ; 2. const wsServer = new WebSocketServer({ ; 3. // This is the `httpServer`...
Read more >
Using STOMP JS
The STOMP Broker · Include STOMP.js · Create a STOMP client · Connection to the server · Heart-beating · Auto Reconnect · Send...
Read more >
WebSocket Security - Heroku Dev Center
The WebSocket protocol doesn't handle authorization or authentication. Practically, this means that a WebSocket opened from a page behind auth ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found