refresh count

My use case is to allow refreshing a token only to a certain count. How do I fetch refresh_count prior to refreshing the token? Is it possible to get refresh_count from an expired refresh token? If not then what is the best way to handle this usecase?

0 2 523
2 REPLIES 2

Not applicable

Hello @Mahammad Feroz,

It seems, there is no "count" that is present to validate and block the number of refresh calls.

So, alternatively, I think, you can set the counts in cache and every time you get a new access token, just increase the count and check if the count has reached the threshold before adding it back to the cache. You can make the key to the cache as the refresh token.

Hope this works !

Not applicable

Hi @Mahammad Feroz,

Yes, the access token has an attribute called "refresh_count", which would let you know the value of how many times the refresh is done.

So, every time you do a Refresh.AccessToken Operation, the count would be increased by 1. You can use this parameter to implement the limit.

You can extract it using extract variable policy like this:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract.AccessTokenResponse"> <DisplayName>Extract.AccessTokenResponse</DisplayName>

<Properties/> <Source>response</Source>

<JSONPayload> <Variable name="refresh_count">

<JSONPath>$.refresh_count</JSONPath>

</Variable> </JSONPayload>

<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>

</ExtractVariables>

Please let me know, if it helps or you need further information.

Happy coding.!