Jump to content
  • 0

Problems logging into the DEMO account with the /session ReST endpoint: 403 with error.security.api-key-invalid error


LanceWalton

Question

Hi.

I can successfully log into the LIVE account with the ReST companion at https://labs.ig.com/sample-apps/api-rest-companion-release/index.html using my live account credentials..

I have some code that I can use to successfully log into the LIVE account using the /session ReST endpoint, using those same credentials.

I can successfully log into the DEMO account with the ReST companion at https://labs.ig.com/sample-apps/api-rest-companion-release/index.html using the same credentials.

But when I try to get my code to log into the DEMO account (using the /session endpoint) using the same DEMO credentials as I just successfully used on the ReST companion, I get a 403 with the error "error.security.api-key-invalid". But I am copying and pasting the api key from my environment variables and pasting it into the application key when logging into the ReST companion, so I know the api key is correct. I've checked for trailing spaces and all of the usual silly mistakes, and I can't find anything.

I've produced some logging to try to help:

[info] 10:05:27.356 INFO  igspreadbets.client.IGClient.$anon - Getting connection info for:
[info] body = {
[info]   "identifier" : "<my demo username>",
[info]   "password" : "<my demo password>"
[info] }
[info] headers = Headers(Content-Type: application/json; charset=UTF-8, Accept: application/json; charset=UTF-8, VERSION: 2, X-IG-API-KEY: <my 40 character API key>)

This fails with the above error.

And after getting this logging, I've tried logging out and logging in again to the ReST companion by copying and pasting the username, password and API Key from the logging above into the ReST companion, and it successfully logs me in.

Any clues?

Link to comment

3 answers to this question

Recommended Posts

  • 0

Ah, wait. I see the problem. I had cleverly split my environment variables over two files (one for public stuff and one for private account stuff), and I'd forgotten that when I switched between the accounts (in my private file), I also needed to switch between the IG URL in my public file. Some refactoring needed...

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • image.png

  • Posts

    • It’s interesting to see the excitement building around Legend of Arcadia, especially now that $ARCA is live on major CEXs with bullish momentum. The recent buzz could very well be tied to the bullish price upon listing and events like PoolX and CandyBomb on exchanges like Bitget, which usually bring more visibility and engagement. It’ll be worth watching to see if this momentum leads to wider GameFi adoption or if it’s just pre-launch hype.
    • In times of inflation, it's clear that traditional savings can lose value quickly, so looking for ways to protect or even grow your money becomes important. A lot of people naturally think of investing in assets like commodities or stocks, which are popular options, but there are other approaches that can help as well. One option is to explore side gigs or freelance work, where you can make money now rather than waiting for long-term investments to pay off. With inflation affecting costs, it can be helpful to have multiple streams of income.
    • Seems Bitget strategic partnership with Ton ecosystem is paying off as Bitget Wallet Lite mini, hits more than 6 million users in 3 days. On Oct. 31, the exchange announced the official launch of Bitget Wallet Lite, a multichain wallet integrated into Telegram, allowing users to buy, store and send crypto within the app. Few months ago, the exchange launches $20M TON ecosystem fund and also TON network secures $30M investment from Bitget and Foresight Ventures, this led the wallet to surpass Metamask in adoption rate. Some users have shown preference to the wallet as compared to Okx and Binance wallet, could it be the friendly nature or ease to connect Ton project? A recent study shows that the wallet impressive growth cut across emerging markets like Africa, South Asia, and the Middle East, could it be the surge in Ton project that is responsible for this feat? The study also claims that the wallet support for over 100 blockchains, and a wide array of DApps, makes the wallet appealing to a global audience. It further claimed that the wallet support for DEX trading, including features like zero gas fees in certain transactions and instant trading modes could be responsible for the surge in users. https://cointelegraph.com/news/bitget-wallet-telegram-6-million-users-three-days
×
×
  • Create New...
us