burakoner / BtcTurk.Net

Open source .Net API wrapper for the BtcTurk web API and websockets API
MIT License
24 stars 9 forks source link

Socket authentication #19

Closed serkancantech closed 2 years ago

serkancantech commented 3 years ago

Socket authentication ile ilgili kod içerisinde BtcTurkAuthenticateSocket metodunda commentli bölümler bulunuyor. BtcTurk api dokümantasyonunda da bilgi görünmüyor. Kullanımla ilgili bilgi verebilir misiniz?

s13rw81 commented 3 years ago

I would also like to understand how to get user data such as order status updates through the websocket.

If you could kindly provide what JSON message to send to the web socket to login and logout I would be very grateful.

Thanks in advance.

burakoner commented 3 years ago

BtcTurk doesnt share how to login for websocket unfortunatelly

s13rw81 commented 3 years ago

if you check the following link https://docs.btcturk.com/websocket-feed/models there is a Model 111 for UserLogin. I have know all the details required in the message to be sent to the web socket except the token. I am not sure if I am supposed to send my API key or secret or something else. If they don't want their customers to use their API then why make it available in the first place ?

I would encourage you to give it a try because I raised an issue on their GitHub but they are yet to reply. If you know Turkish maybe you will be able to better explain the situation to them.

Thanks a lot in advance.

burakoner commented 3 years ago

I had many connections with BtcTurk. I mean face to face meetings. They dont share Token Algorithm unfortunatelly. In fact, I can get this token from an active web page connection but this wont be usable for all developers using this library. And Tokens can expire.

One more thing. If you look closer https://github.com/burakoner/BtcTurk.Net/tree/master/docs I shared all swagger files. I got these files from BtcTurk. And my library uses V3 api endpoints. BtcTurk doesnt share V3 documentation and authendication algirithm is different from V1.

So I cant move forward on websocket authentication, I'll write again to them, If I get a positive answer I'll update library.

By the way you can extend BtcTurk.Net BtcTurkSocketClient and give ability to log in with a static token that you can find in your web browser.

s13rw81 commented 3 years ago

This is very unfortunate for all of us. Thank you very much for pointing me to swagger files, I will go through them as they might be useful to me. By the way you can extend BtcTurk.Net BtcTurkSocketClient and give ability to log in with a static token that you can find in your web browser. I will give this a try later, I think this is worth exploring if there is a specific endpoint we could hit to get the access token then it will be exactly what we need. Moreover they cannot change this easily I think.

burakoner commented 3 years ago

I wrote to BtcTurk again after your message. I am waiting a response. Let us wait together. If I get a positive answer I'll update BtcTurk.Net library. If I dont get answer or or get a negative answer, I'll write and share a code snippet to implement using web token.

s13rw81 commented 3 years ago

I too sent them a mail, i dont think they will budge. Your swagger files are proving very useful and I am very thankful to you for making them. If there is an endpoint that they use on the website where if we send the correct headers and payload we get back the access tokon for the websocket, then i think we can start work on that.

I will try to look for it but in case you have found it already or find it in future do post them here. Thus will be of great help. I briefly interacted with the developers of ccxt and they have not started work on BTCTurk websocket part yet. Lets see what they come up with. I think you could also contribute to ccxt because you know a lot about BTCTurk and they could use your help and experience.

serkancantech commented 3 years ago

@burakoner any example for "By the way you can extend BtcTurk.Net BtcTurkSocketClient and give ability to log in with a static token that you can find in your web browser."

s13rw81 commented 3 years ago

Checkout BTCTraders's response to my issue.

burakoner commented 3 years ago

Yes I know. The problem is they dont share how to generate a new jwt token.

burakoner commented 3 years ago

I'll write a little code to implement a login method. It will to copy jwt token from web browser