ApiGee X token to cache and its lookup

Hi,

I followed post https://www.googlecloudcommunity.com/gc/Apigee/Need-to-Develop-oauth-token-caching-proxy/m-p/498161#... and managed to store the JWT and look it up on a subsequent call. Good.

What I need is that OAuth2 access_token, sent by API caller, is used as cache key and value will be the JWT I've got from an IdP introspection callout originally.

This works (static key name):
<CacheKey>
<KeyFragment>access_token</KeyFragment>
</CacheKey>

And this does not (dynamic access_token):
<CacheKey>
<KeyFragment ref="inbound.access_token"/>
</CacheKey>

(inbound.access_token has been resolved in a previous step and it can be seen on debug console)

Can anyone see why wouldn't that dynamic way work? 

0 1 112
1 REPLY 1

Ooops. My test case was a page refresh, which in turn generated a new access_token every time thus cached value wasn't used in my tests at all. The debugger may have mislead me a bit but accidentally, and luckily, I hit "FlowInfo" which showed the access_token in the key name. Having tested the front SPA with page load and then x amount of actions from within the SPA showed that JWT was obtained only once at load time and latter calls used the cached value.