Let me explain the use of the cascade flag.
Below are the 4 cases:
case 1: cascade=true and type=access_token: This would revoke the access_token and the associated refresh_token too.
case 2: cascade=false and type=access_token: This would revoke the access_token but not the refresh_token associated with it.
case 3: cascade=true and type=refresh_token: This would revoke the refresh_token and the associated access_token(s)
case 4: cascade=false and type=refresh_token: This would revoke the refresh_token but not the associated access_token(s)
NOTE: When the refresh_token is used to generate a new access_token, we check the status of the original access_token and throw an error if the access token is revoked: com.apigee.oauth.v2.TokenGenerationException: Access Token not approved.
To understand why it is implemented this way, let’s take a few use-cases:
Say your access_token is compromised, so you would want to revoke the access_token. You can choose to revoke both the access_token and the refresh_token(case 1) or just the access token (case 2). In both cases, we cannot use the refresh_token to generate new tokens.
The reason for this is: if someone has got hold of your access_token, they can make the access_token details call and also get hold of your refresh_token, which means both are compromised, and hence the feature is implemented this way.
So the question now is, “what’s the use of the cascade query param?”.
The real use of the cascade flag is when you revoke a refresh token. Say you decide that you want to prevent any further generation of access tokens for a refresh_token but you want to keep the existing tokens and let them continue to work. So you would use case 4 by setting cascade=false for revoking the refresh_token. The other usecase, where you would want to revoke both the refresh_token and the access_token, that’s where case 3 comes in.
I think this is working the way its designed and doesn’t require any changes. For case 1 and case 2, generating new access tokens is the way to go instead of trying to use refresh token to generate new access tokens.
If the use-case is around session management then you should set the access token expiry to be close to the session timeout value instead of trying call the revoke token api when session expires. That way the access_token expires, but you can still work with the refresh_token to generate new tokens without asking for the user consent. Hope this explains.