Closed evanlanglais closed 4 years ago
To add a bit of context as to why this fix is needed:
The receivedTtl value, assigned with token ttl value of the auth HTTP POST request, is not actually passed by reference to the Cache.Wrap function. Instead, the value of receivedTtl at the time of calling Cache.Wrap, null, is passed and subsequently used, causing the default cache ttl to be used instead of the received one, resulting in the auth 401 error documented in #304
By passing a lambda which immediately resolves to the receivedTtl value, it pulls the reference to that variable all the way into the Cache function, and because the data function is resolved before reading the ttl value it should always resolve to the proper ttl returned by the auth request.
Excellent find.
Thank you for the pull request!
Pass the received access token TTL to the Cache.Wrap function through a lambda to capture value reference.
Closes #304