Re: Access token expired fix and other alternatives

harsh_rohilla
Level 1

Access token expired fix and other alternatives

Hi, I faced a similar issue. I used to get an 'access token expired' error message from marketo. To fix the issue, we adopted a naive approach of checking if the 'expires-in' for a particular token is less than 10s,then we added a delay of 11s using Javascript setTimeout wrapped in a promise to call the identity endpoint to generate a new token. This will create a new token each time when 'expires-in' for a current time is less than 10s but the catch here is technically my AWS lambda function is taking 11s more for executing which eventually will increase the lambda costing. Please suggest some alternatives to solve this problem. Although each of our operations takes less than 5 sec and token expiring is a rarity. We are dealing with sensitive data here and can't afford this problem.

1 REPLY 1
SanfordWhiteman
Level 10 - Community Moderator

Re: Access token expired fix and other alternatives

Have to say your current approach is just... the worst imaginable architecture. It also isn’t even a fix because you can’t rely your own knowledge of the TTL, clocks could become skewed!

 

The correct approach is to treat the app-level 601 error as a known exception and retry. Why would you not do this?