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
  • General Statistics

    • Total Topics
      21,601
    • Total Posts
      91,807
    • Total Members
      41,868
    • Most Online
      7,522
      10/06/21 10:53

    Newest Member
    jasebob
    Joined 21/03/23 13:16
  • Posts

    • ūüüĘGBPCHF broke and closed above a major falling trend line on a daily. The broken trend line turned into a key vertical support now. Probabilities will be high, that a bullish movement will initiate from that. ¬† Next goals for buyers: 1.1423 / 1.151 For Additional confirmation use:¬†Leading Indicators
    • Shopify Inc., Elliott Wave Technical Analysis Shopify Inc.,(SHOP:NASDAQ): Daily Chart, 21 March 23, SHOP Stock Market Analysis: Shopify keeps moving sideways as expected, as it stays between the 20 and 200EMA. As long as we do not break the red line we can assume we will be seeing further downside.¬†¬† SHOP Elliott Wave Count: Wave (iv) of {i}. SHOP Technical Indicators: At the cross of 20 and 200EMA. SHOP Trading Strategy: Waiting for a potential triangle in wave (iv). TradingLounge Analyst: Alessio Barretta ¬† ¬† Shopify Inc., SHOP: 4-hour Chart, 21 March 23, Shopify Inc., Elliott Wave Technical Analysis SHOP Stock Market Analysis: We keep moving sideways in a three wave manner, which confirms the fact we are in a corrective structure. We are moving between the 50% and 38.2% retracement of (iii).¬†¬† SHOP Elliott Wave count: Wave (iv) of {i}. SHOP Technical Indicators: Above all averages.¬†¬† SHOP Trading Strategy: Looking for sideways continuation in wave (iv).
    • Elliott Wave Analysis TradingLounge Daily Chart, 21 March 23,¬†¬† Ethereum/U.S.dollar(ETHUSD) ETHUSD Elliott Wave Technical Analysis¬† Function: Follow trend Mode: Motive Structure: Impulse Position: Wave III Direction Next higher Degrees: wave (I) of Motive Details: Wave 3 equals 1.618 multiplied Length of wave 1 at 2943.53 Wave Cancel invalid level: 1073.42 Ethereum/U.S.dollar(ETHUSD)Trading Strategy: Ethereum resumes its upward trend in wave III with a chance to reach the 161.8 level of wave I at 2943.53. Also, the price has risen above the MA200 line, giving the view to a continued upward trend in wave III. Ethereum/U.S.dollar(ETHUSD)Technical Indicators: The price is above the MA200 indicating an UpTrend. The wave oscillators above Zero-Line momentum are bullish. TradingLounge Analyst: Kittiampon Somboonsod, CEWA ¬† ¬† Elliott Wave Analysis TradingLounge 4H Chart, 21 March 23,¬†¬† Ethereum/U.S.dollar(ETHUSD) Elliott Wave Technical Analysis Function: Follow trend Mode: Motive Structure: Impulse Position: Wave (3) Direction Next higher Degrees: wave ((3)) of Motive Details: Wave 3 equals 1.618 multiplied Length of wave 1 at 2290 Wave Cancel invalid level: 1369 Ethereum/U.S.dollar(ETHUSD)Trading Strategy: Ethereum resumes its upward trend in wave (3) with a chance to reach the 161.8 level of wave (1) at 2290. Also, the price has risen above the MA200 line, giving the view to a continued upward trend in wave (3). Ethereum/U.S.dollar(ETHUSD)Technical Indicators: The price is above the MA200 indicating an UpTrend. The wave oscillators above Zero-Line momentum are bullish.
×
×
  • Create New...