"ACCESS_DENIED Error When Requesting Access Token via Open API"
Created at 15 Nov 2024, 15:20
VA
"ACCESS_DENIED Error When Requesting Access Token via Open API"
15 Nov 2024, 15:20
Hello cTrader Community,
I am currently working on a trading bot project using the cTrader Open API. I am facing a persistent issue when trying to retrieve an access token using my client_id
and client_secret
. Here is a summary of my problem:
Problem Description:
- I successfully open the authorization URL in the browser and receive the authorization code.
- However, when I use this code to request an access token, I keep receiving the following error response:
- The status code of the response is 200, but the access token is not returned.
Debug Information:
client_id
,client_secret
, andredirect_uri
are all taken directly from my cTrader Open API application.- I have verified that the
client_id
andclient_secret
are correct, and the redirect URI matches the one registered in the developer portal. - I have also tried both the "Account info" and "Account info and trading" scopes, but the error persists.
Request Details:
- Authorization URL: I can successfully generate this URL and get the authorization code.
- Token Request:
- URL:
https://connect.spotware.com/apps/token
- URL:
Steps Taken:
- I’ve ensured that my
client_id
andclient_secret
are correctly copied from my application. - I’ve matched the
redirect_uri
with the one specified in my application settings. - I have tried multiple authorization codes, ensuring that they are freshly generated.
- I’ve also experimented with embedding the credentials directly in the code, but the result is the same.
Request for Help:
- Has anyone encountered this "ACCESS_DENIED" error before when using valid credentials?
- Are there any specific requirements or common pitfalls with the cTrader Open API authentication process that I may be missing?
- Any advice or pointers on what else I could try would be greatly appreciated.
Thank you for taking the time to help!
Best regards,
Vasilios Gerasimou
PanagiotisCharalampous
16 Nov 2024, 11:40
Hi Vasilie,
Try using https://openapi.ctrader.com/apps/token to retrieve the token and let me know if this works.
Best regards,
Panagiotis
@PanagiotisCharalampous