Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 230663

Re: Looking for a way to cache an auth token in vRO

$
0
0

You could use a Resource Element to store this in, I've done the same thing various times. My basic premise looks like this:

 

01) Create Workflow with Locking that first checks Resource Element and examines expiry time of token

02) If token has expired, it fetches a new one and updates Resource Element. If not, it retrieves the stored one

03) Wfl is unlocked at the end (and also unlocked in default error handling)

04) (everything can use the same wfl to fetch a token for that API as the locking should prevent token clashes)

 

Make sure you use locking because you don't want the same wfl hit by 2 instances or you'll probably get token clash. By the same respect, be sure to allow unlocking on error. I prefer storing the entire token but my wfl has 2 outputs, the full token and just the 'token' part of it so I can null out the one I don't want. Also, depending on the token, watch out for things like 'token lifetime' vs 'token refresh' as some systems will have a valid time of e.g. 24hrs but that's only valid if you keep refreshing the thing (it seemed fairly redundant and a little insecure to me keeping a token valid just in case it might be required).


Viewing all articles
Browse latest Browse all 230663

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>