Jump to content
  • 0

REST API OAuth token refresh routine became unstable


ArturCz

Question

Hey,

I'm working with IG's OAuth authentication process to keep an authenticated session in my REST API client. As IG's OAuth access token expires every 60 seconds, I refresh the access token with the provided refresh token every 55 seconds to keep a valid access token at all times (having a look at network traffic in IG's REST API companion, it looks like it's done exactly the same way there).

However, recently the POST /session/refresh-token v1 interface became very unstable, often throwing error.security.invalid-details or error.security.authentication.timeout. As I use an exponential backoff retry mechanism behind the requests, the requests sometimes works after 3 or 4 retries (after 10ms to 100ms delay before I trigger the next retry). However, sometimes the requests don't succeed at all and I'm forced to create a new session with the POST /session v3 interface (which has worked as a last resort for now).

Even if I have recovery mechanisms in place to ensure a valid access token, it's a bit odd that POST /session/refresh-token v1 fails this often recently. Session management is the most basic layer of an API and it shouldn't be this unstable.

I should mention that I run two distinct processes which maintain their own authenticated sessions. But even with two sessions I'm doing 2 non-trading requests per 55 seconds which is well within IG's REST API quotas.

It looks like the POST /session/refresh-token v1 interface might be overloaded on IG's side for some reason recently. If this is the case it might be helpful that I call attention to this issue here. If this isn't caused by an overload on IG's side I would appreciate some feedback what I should do different (which would ultimately imply that it is not done in the very correct way in IG's REST API companion as well).

I would appreciate if there is some feedback regarding this issue!

Best regards,

ArturCz

Link to comment

1 answer to this question

Recommended Posts

  • 0

After a week this issue seems to be resolved for now, session refreshes are not failing frequently anymore. Seems like the cause of this issue was in IG's backend but got resolved. From the outside I would guess that the backend was overloaded somehow or that there was some internal server logic error. I will revive this thread again if the issue comes back.

This shows: if you are planning to use an API for automated trading, make sure to try to automatically resolve basic issues with ALL tools available to prevent the trading operation from failing. Fortunately, I had/have the mechanisms in place to handle most quirks of IG's API to literally force the API to function. Otherwise my trading operation would probably have been unusable during the last week.

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

    • Dopamine emerges as a beacon of innovation in the world of cryptocurrency management, offering a non-custodial, secure, and anonymous mobile app wallet. With over two million downloads and a robust user base, Dopamine is reshaping the landscape of decentralized finance (DeFi) on both Android and iOS platforms. Let's delve into the features and functionalities that make Dopamine a must-have tool for navigating the cryptocurrency market. Key Features: 1. Comprehensive Portfolio Tracking: Dopamine's native token, $DOPE, empowers users to monitor their favorite projects from a vast collection of over 10,000 coins, ensuring informed decision-making in the dynamic crypto market. 2. Enhanced Security Measures: With built-in Anti-Money Laundering services, Dopamine enables users to safeguard their assets by identifying potential fraud and assessing risk scores associated with their wallets. 3. Real-Time Market Insights: Stay ahead of the curve with Dopamine's ability to track market trends and identify coins making significant moves, ensuring users remain informed and proactive in their investment strategies. 4. Cross-Chain NFT Transactions: Seamlessly send and receive NFTs across various blockchains, including Ethereum, BSC, Fusion, and more, providing users with unparalleled flexibility and interoperability. 5. Efficient Information Management: Dopamine simplifies data management by allowing users to save essential information and access it instantly, streamlining their crypto journey with convenience and ease. 6. Convenient Fiat On-Ramp: Facilitating seamless transactions, Dopamine enables users to buy crypto directly from their credit or debit card within the app, eliminating the need for multiple platforms and intermediaries. 7. DeFi Gaming Integration: Dive into the exciting world of decentralized finance gaming with Dopamine, offering users access to a diverse range of DeFi games directly from the app, adding a touch of entertainment to their crypto experience. With its innovative features, commitment to user empowerment and upcoming listing on Bitget exchange, Dopamine stands as a revolutionary platform that caters to the diverse needs of cryptocurrency enthusiasts. As the cryptocurrency market continues to evolve, It remains at the forefront, providing users with a secure, versatile, and intuitive solution for managing their digital assets and exploring new horizons in decentralized finance.
    • Name of stock: Adventus Mining Name of Stock Exchange: TSX Leverage or Share dealing: Share dealing Ticker: ADZN Country of stock: Canada
×
×
  • Create New...
us