Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

websocket authentication using python #190

Open
o5mo-lj opened this issue Jun 29, 2020 · 1 comment
Open

websocket authentication using python #190

o5mo-lj opened this issue Jun 29, 2020 · 1 comment

Comments

@o5mo-lj
Copy link

o5mo-lj commented Jun 29, 2020

Hi, I've been unable to authenticate using websockets (to access account streams). Is there any example of this being done in python? I'm building the signature as below and I'm receiving the error message "authentication failed. authentications failed. invalid signature" Any advice?

nowInMilisecond = str(int(time.time() * 1000))
path = "/users/self/subscribe"
stringToSign = path + "\n" + nowInMilisecond

update_param__str = stringToSign
update_param_byteencoded = update_param_str.encode()

new_hmac = hmac.new(
secret_byteencoded,
msg=update_param__byteencoded,
digestmod=hashlib.sha512,
)
new_hmac_updated_hexdigested = new_hmac.hexdigest()

return nowInMilisecond, new_hmac_updated_hexdigested

@martin-nginio
Copy link
Contributor

Hi @lukejamesp

Thanks for your feedback.

Please find below Authentication sample in node.js
https://github.com/ngin-io/websocket-client-node/blob/master/index.js

and this one is Java:
https://github.com/ngin-io/websocket-client-java/blob/master/src/main/java/io/ngin/websocket/sample/client/java/WebSocketClient.java

They might be useful as. you can compare your python generated signature with any above.

After reviewing those if you are still getting errors please let us know and we will add python authentication sample as well

Thanks.

Regards,
Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants