Skip to content
This repository has been archived by the owner on Nov 5, 2019. It is now read-only.

Fall back to using an access_token for revocation. #134

Merged
merged 1 commit into from
Mar 17, 2015

Conversation

craigcitro
Copy link
Contributor

According to the OAuth2 docs, we can use either the refresh token or access token when revoking a token. If we've lost the refresh token for some reason, we should fall back to revoking via access token. (Note that if the access token has expired, this will still raise, which is the correct behavior.)

Fixes #132.

@craigcitro
Copy link
Contributor Author

PTAL @nathanielmanistaatgoogle

@@ -817,7 +817,8 @@ def _revoke(self, http_request):
http_request: callable, a callable that matches the method signature of
httplib2.Http.request, used to make the revoke request.
"""
self._do_revoke(http_request, self.refresh_token)
token = self.refresh_token or self.access_token

This comment was marked as spam.

@@ -811,13 +811,13 @@ def _do_refresh_request(self, http_request):
raise AccessTokenRefreshError(error_msg)

def _revoke(self, http_request):
"""Revokes the refresh_token and deletes the store if available.
"""Revokes this token and deletes the stored copy (if available).

This comment was marked as spam.

This comment was marked as spam.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 64.68% when pulling 69c470c on craigcitro:revoke into d68049b on google:master.

According to the [OAuth2
docs](https://developers.google.com/accounts/docs/OAuth2WebServer#tokenrevoke),
we can use either the refresh token or access token when revoking a token. If
we've lost the refresh token for some reason, we should fall back to revoking
via access token. (Note that if the access token has expired, this will still
raise, which is the correct behavior.)

Fixes googleapis#132.
craigcitro added a commit that referenced this pull request Mar 17, 2015
Fall back to using an access_token for revocation.
@craigcitro craigcitro merged commit 7504459 into googleapis:master Mar 17, 2015
@craigcitro craigcitro deleted the revoke branch March 17, 2015 21:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revoking with the access token throws a TokenRevokeError
4 participants