File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -811,16 +811,16 @@ def _do_refresh_request(self, http_request):
811
811
raise AccessTokenRefreshError (error_msg )
812
812
813
813
def _revoke (self , http_request ):
814
- """Revokes the refresh_token and deletes the store if available .
814
+ """Revokes this credential and deletes the stored copy ( if it exists) .
815
815
816
816
Args:
817
817
http_request: callable, a callable that matches the method signature of
818
818
httplib2.Http.request, used to make the revoke request.
819
819
"""
820
- self ._do_revoke (http_request , self .refresh_token )
820
+ self ._do_revoke (http_request , self .refresh_token or self . access_token )
821
821
822
822
def _do_revoke (self , http_request , token ):
823
- """Revokes the credentials and deletes the store if available .
823
+ """Revokes this credential and deletes the stored copy ( if it exists) .
824
824
825
825
Args:
826
826
http_request: callable, a callable that matches the method signature of
Original file line number Diff line number Diff line change @@ -560,6 +560,14 @@ def test_token_revoke_failure(self):
560
560
self , '400' , revoke_raise = True ,
561
561
valid_bool_value = False , token_attr = 'refresh_token' )
562
562
563
+ def test_token_revoke_fallback (self ):
564
+ original_credentials = self .credentials .to_json ()
565
+ self .credentials .refresh_token = None
566
+ _token_revoke_test_helper (
567
+ self , '200' , revoke_raise = False ,
568
+ valid_bool_value = True , token_attr = 'access_token' )
569
+ self .credentials = self .credentials .from_json (original_credentials )
570
+
563
571
def test_non_401_error_response (self ):
564
572
http = HttpMockSequence ([
565
573
({'status' : '400' }, b'' ),
You can’t perform that action at this time.
0 commit comments