accessToken not detected?
accessToken not detected?
07 Nov 2023, 23:35
Hi! I'm trying to connect to the Open API. I got past the OAuth step and has an access token. However, when I try to send a PROTO_OA_GET_ACCOUNTS_BY_ACCESS_TOKEN_REQ (2149), it errs out stating that accessToken
isn't provided even though that it was. Below is the log. I print the message to be sent right before sending it over WebSocket. Note that it works for PROTO_OA_APPLICATION_AUTH_REQ (2100) so it's not a connection issue. Any idea where else to look? Thanks for any insights!
Connected to: wss://demo.ctraderapi.com:5036
Sending: {"clientMsgId":"7d04cbf6-8140-49c6-9b55-fbbe1c79da9a","payloadType":2100,"payload":{"clientId":"<redacted>","clientSecret":"<redacted>"}}
Response: { payloadType: 2101,
clientMsgId: '7d04cbf6-8140-49c6-9b55-fbbe1c79da9a' }
Sending: {"payloadType":2149,"accessToken":"<redacted>"}
Response: { payloadType: 2142,
payload:
{ errorCode: 'INVALID_REQUEST',
description: 'Message missing required fields: accessToken' } }
Connection closed: 1000 <Buffer 42 79 65>
Replies
honfaikan5
10 Nov 2023, 18:24
( Updated at: 11 Nov 2023, 07:05 )
Thank you Panagiotis. I got some ideas from the Telegram space, but now I can't seem to connect to try out those ideas. It seems like 5035 works but the SSL certificate is now invalid, and 5036 doesn't respond at all. I'm trying to use Websocket/JSON option (port 5036). I've tried the following on both my local machine and a Linode machine external to my network. Any idea what else I could try?
$ websocat -v wss://demo1.p.ctrader.com:5035
[INFO websocat::lints] Auto-inserting the line mode
[INFO websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[INFO websocat::ws_client_peer] get_ws_client_peer
websocat: WebSocketError: WebSocket SSL error: The certificate was not trusted.
websocat: error running
$ websocat -v wss://demo1.p.ctrader.com:5036
[INFO websocat::lints] Auto-inserting the line mode
[INFO websocat::stdio_threaded_peer] get_stdio_peer (threaded)
[INFO websocat::ws_client_peer] get_ws_client_peer
websocat: WebSocketError: I/O failure
websocat: error running
Thank you for any insights!
@honfaikan5
PanagiotisCharalampous
11 Nov 2023, 07:13
( Updated at: 11 Nov 2023, 07:14 )
Hi there,
Unfortunately I cannot help you further since the technologies you use are beyond my skillset. If you can reproduce the problem using any of our example applications, I am happy to have a look.
Best regards,
Panagiotis
@PanagiotisCharalampous
honfaikan5
13 Nov 2023, 13:39
Thank you so much for the help! My issue got resolved in Telegram.
@honfaikan5
PanagiotisCharalampous
08 Nov 2023, 06:35
Hi there,
If you get this message then probably that's the problem. Your log does not shed any light to what your code is actually doing. It would be easier for you to compare your implementation to the example application and see what you are doing different. If you can reproduce the issue with the example application, then we are happy to have a look.
Best regards,
Panagiotis
@PanagiotisCharalampous