'How can I revoke tokens created through Cognito oauth/token url

We have an application implemented on api-gateway and lambda, the authentication is carried by tokens generated on Cognito, Cognito has the Client credentials OAuth Flow with custom scopes. We are using the oauth/token url to generate access tokens, we tried to create refresh tokens, but the oauth/authorize isn't working, because the Client credential flow restrict the Authorization code grant.

On the middle of the process we need these tokens to be revoked, but the oauth/revoke needs the refresh token that we can't generate because of the chosen flow, How can we can revoke those tokens?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source