Share via

Refresh token but have a ForEach loop downstream

sam nick 366 Reputation points
2023-05-04T16:48:38.1+00:00

Hello,

My the below pipeline, i get the access token from my web activity followed by the for each loop. That access token is used for every single transaction within the For each loop. The lookup has around 3k rows, so, the foreach runs for 3k times.

Any recommendation on how to refresh the access token with jeopardizing/breaking the foreach loop . The loop can run for 30 mins or 45 or 90 mins.

User's image

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Sedat SALMAN 14,455 Reputation points MVP
    2023-05-04T20:44:45.9533333+00:00
    1. Add a variable to store the token expiration time (e.g., tokenExpirationTime).
    2. Modify your web activity to store both the access token and the expiration time.
    3. Inside the ForEach loop, add a conditional activity to check if the current time is greater than or equal to the tokenExpirationTime.
    4. If the condition is true, refresh the access token using another web activity and update the tokenExpirationTime.
    5. Proceed with the remaining actions in the ForEach loop using the updated access token.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.