Apply KeyValueMap Delete method based on time

Not applicable

I have a scenario where i need to use KVM put method to update some token value(token expire time let say 1 hour),So how could i use KVM delete method to delete the entry in KVM just after the token is expired.

Solved Solved
0 5 326
1 ACCEPTED SOLUTION

Hi @Umanng Goel,

Check this answer here

This outline similar solution where an token from target system is cached.

This is kind of a pattern to use oAuth token based target systems.

View solution in original post

5 REPLIES 5

Hi @Umanng Goel,

Instead of storing the tokens in KVM, you can use the Populate Cache and Lookup Cache for this scenario where in Populate Cache you can set an expiry time so that token will be cleared from cache automatically when the time expires.

Hi @Umanng Goel,

Check this answer here

This outline similar solution where an token from target system is cached.

This is kind of a pattern to use oAuth token based target systems.

@Mohammed Zuber

Thanks for your Response.

Here are my concerns

1:The token is provided by third party and we are calling it internally in apiproxy using service callout through a different resource (i.e like /token) and storing the token using KVM.

2:So now i can use the stored token using kvm property with another resource(say /email) and access my request.

3:The concern is I don't want the user to call the (/token) api again and again to regenerate the token, as the same token is not yet expired.

4:Once the token is expired ,then we can make a call to (/token) to regenerate the token.

So I thought of using Delete method to delete the token variable after a specific time when it get expired.Look like its not happening.

Hello @Mohammed Zuber

It really gave me some idea to implement in my scenario.

Thanks a lot. 🙂

HI @Umanng Goel

I believe you have an external Token provider service that generates a token. And you want to use that token for any apigee call to validate. This is an apt use case for "External Auth". Please take a look at this link. You can store the token into Apigee and use that to validate as if Apigee created it. So in that case, you VerifyAccessToken will work automatically. You can set the expiry time with same or 1 second lesser than the one set by the external auth system.

Let me know if this helps.