hootnot / oanda-api-v20

OANDA REST-V20 API wrapper. Easy access to OANDA's REST v20 API with oandapyV20 package. Checkout the Jupyter notebooks!
MIT License
398 stars 107 forks source link

Keep on getting `The provided request was forbidden` error. #202

Closed Alkasai closed 1 year ago

Alkasai commented 1 year ago

A few months ago, I created a few new live accounts and was trying to trade using v20 API. I then realized that the new accounts were getting an error. This was true only for the new accounts. The old account was working just fine.

I tried running curl and the same thing was true for the new account. The old accounts were (and still are) responding with success.

Here is the curl command that I run for -010 account ID:

curl -H "Content-Type: application/json" -H "Authorization: Bearer MY_API_KEY" "https://api-fxtrade.oanda.com/v3/accounts/MY_ACCOUND_ID_PREFIX-010/summary"

And the error I get:

{
    "errorMessage": "The provided request was forbidden."
}

However, if I run the same command for -005 account ID, its response with the proper account summary:

{
  "account": {
    ...
  },
  "lastTransactionID": "7937"
}

Yes, I have ensured that the account IDs, URLs and API key are correct. I have also spoken to the support for the past 2-3 months over emails, and all I get is we are unable trace the issue. My last email included the specific timestamp to help them trace the logs, but I haven't heard back from them yet.

This is a live account, and this prevents me from trading. I would really love to get this resolved.

Alkasai commented 1 year ago

Actually, just realized that this is not the official OANDA API repo. 😅 🤦 Sorry about that. I'll go look for the original one and try support again.

hootnot commented 1 year ago

FWIW: revoke your token and generate a new one.

More issues like yours were resolved by doing that.

Alkasai commented 1 year ago

Omg, how didn't I think about this..? I'll give it a try.

Alkasai commented 1 year ago

That worked! Thank you @hootnot!!