| 1 | from typing import Any |
| 2 | |
| 3 | from .base import AuthenticationBase |
| 4 | |
| 5 | |
| 6 | class RevokeToken(AuthenticationBase): |
| 7 | """Revoke Refresh Token endpoint |
| 8 | |
| 9 | Args: |
| 10 | domain (str): Your auth0 domain (e.g: my-domain.us.auth0.com) |
| 11 | """ |
| 12 | |
| 13 | def revoke_refresh_token(self, token: str) -> Any: |
| 14 | """Revokes a Refresh Token if it has been compromised |
| 15 | |
| 16 | Each revocation request invalidates not only the specific token, but all other tokens |
| 17 | based on the same authorization grant. This means that all Refresh Tokens that have |
| 18 | been issued for the same user, application, and audience will be revoked. |
| 19 | |
| 20 | Args: |
| 21 | token (str): The Refresh Token you want to revoke |
| 22 | |
| 23 | See: https://auth0.com/docs/api/authentication#refresh-token |
| 24 | """ |
| 25 | body = { |
| 26 | "client_id": self.client_id, |
| 27 | "token": token, |
| 28 | } |
| 29 | |
| 30 | return self.authenticated_post( |
| 31 | f"{self.protocol}://{self.domain}/oauth/revoke", data=body |
| 32 | ) |