live URL
live URL
28 Oct 2020, 17:44
I have managed to get oauth 2.0 working by using the .net winforms example
with my ctrader details (secret, client, token) it still returns the example account number
i believe this is because im calling URL and Port
tradeapi.spotware.com 5035
what should this be to go live and see my account details?
Replies
jayteasuk
29 Oct 2020, 17:15
RE:
jayteasuk said:
I have managed to get oauth 2.0 working by using the .net winforms example
with my ctrader details (secret, client, token) it still returns the example account number
i believe this is because im calling URL and Port
tradeapi.spotware.com 5035
what should this be to go live and see my account details?
I connect by creating a TcpClient and set up a SslStream for remote certificate validation, connecting to demo.ctraderapi.com:5035. I then call to CreateAppAuthorizationRequest, passing in my ClientId and my ClientSecret.
I then make a request for an account list by calling the CreateAccountListRequest passing in my token. The resulting message I receive contains one account id, with a status of demo.
...When I try tradeapi.spotware.com I receive the folloeing message:
Received: ProtoMessage{GetAccountsByAccessTokenRes{ID: 19137822 Status: Demo
}}
Received: ProtoMessage{ErrorResponse{errorCode:CANT_ROUTE_REQUEST, description:No environment connection}}
Received: ProtoMessage{ErrorResponse{errorCode:INVALID_REQUEST, description:Trading account is not authorized}}
This is what the documentation says:
CANT_ROUTE_REQUEST Connection to Server is lost or not supported.
INVALID_REQUEST Generic error. Usually used when the input value is incorrect.
When I comnnect using live.ctraderapi.com, I get the exact same output and error message.
@jayteasuk
PanagiotisCharalampous
30 Oct 2020, 12:08
Hi jayteasuk,
I do not see what is the problem. If you only have one demo account then you can authorize it only on demo.ctraderapi.com:5035. tradeapi.spotware.com is not a valid proxy for Open API 2.0 and live.ctraderapi.com should be used only for live accounts.
Best Regards,
Panagiotis
@PanagiotisCharalampous
jayteasuk
30 Oct 2020, 13:52
RE:
jayteasuk said:
I have managed to get oauth 2.0 working by using the .net winforms example
with my ctrader details (secret, client, token) it still returns the example account number
i believe this is because im calling URL and Port
tradeapi.spotware.com 5035
what should this be to go live and see my account details?
is that live.ctraderapi.com without a port number?
in relation to the auth code would this be the auth code from the playground area?
if not how would i get the correct auth code?
@jayteasuk
PanagiotisCharalampous
30 Oct 2020, 15:24
Hi jayteasuk,
The port is 5035, the same as for demo.ctraderapi.com. I am not sure which code are you referring to, if you are looking for open authentication instructions, check here.
Best Regards,
Panagiotis
@PanagiotisCharalampous
jayteasuk
31 Oct 2020, 22:48
RE:
PanagiotisCharalampous said:
Hi jayteasuk,
The port is 5035, the same as for demo.ctraderapi.com. I am not sure which code are you referring to, if you are looking for open authentication instructions, check here.
Best Regards,
Panagiotis
I got this sorted I hadn't realised my auth code needed renewing so had defaulted back to the demo auth code
Thanks for assisting
@jayteasuk
PanagiotisCharalampous
29 Oct 2020, 08:24
Hi jayteasuk,
You need to provide more information. Can you please describe the exact steps you follow? How did you implement OAuth? which parts of the code did you modify? Which part of the code returns the example account number?
Best Regards,
Panagiotis
Join us on Telegram
@PanagiotisCharalampous