I thought the code snippet I have in the question would be the most direct way to validate a refresh_token and at the same time revoke both access_token and refresh_token using a refresh_token as identifier. As when I want to revoke/totally delete both tokens, but using access_token as identifier, I could just do this.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DeleteOAuthV2Info name="OA-DeleteAccessToken" enabled="true" continueOnError="true">
<AccessToken ref="request.queryparam.access_token"/>
<DisplayName>OA-DeleteAccessToken</DisplayName>
</DeleteOAuthV2Info>
Odd, that I had to resort to using multiple policies and fault rules just to trigger this particular scenario. Hopefully there’s a more direct way really because as far as I know, tokens should be able to be revoked even when using refresh_token too as this is the standard in oauth as I was told by our lead developer.
In light of this policy behavior, I thought of refreshing the access_token and make it valid for a couple of seconds, for me to invalidate both access & refresh token, but it would just make me add another policy for this to be accomplished.
So, knowing that I could revoke both tokens using an access_token anyway, and I have to validate whether if the refresh_token is valid or not in our proxy anyway. I just had this
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<GetOAuthV2Info async="false" continueOnError="false" enabled="true" name="GOA-GetRefreshTokenInfo">
<DisplayName>GOA-GetRefreshTokenInfo</DisplayName>
<RefreshToken ref="request.formparam.refresh_token"/>
</GetOAuthV2Info>
To check the validity of a refresh_token
& this
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DeleteOAuthV2Info name="OA-DeleteAccessToken" enabled="true" continueOnError="true">
<AccessToken ref="apigee.access_token"/>
<DisplayName>OA-DeleteAccessToken</DisplayName>
</DeleteOAuthV2Info>
To invalidate both tokens using an access_token that was made available in the flow variable apigee.access_token when I had the GetOAuthV2Info in the earlier flow.
This would be a good workaround I guess.