@@ -734,6 +734,7 @@ def __init__(self,
734
734
def _obtain_token (
735
735
self , grant_type , params = None , data = None ,
736
736
also_save_rt = False ,
737
+ on_obtaining_tokens = None ,
737
738
* args , ** kwargs ):
738
739
_data = data .copy () # to prevent side effect
739
740
resp = super (Client , self )._obtain_token (
@@ -753,7 +754,7 @@ def _obtain_token(
753
754
# but our obtain_token_by_authorization_code(...) encourages
754
755
# app developer to still explicitly provide a scope here.
755
756
scope = _data .get ("scope" )
756
- self .on_obtaining_tokens ({
757
+ ( on_obtaining_tokens or self .on_obtaining_tokens ) ({
757
758
"client_id" : self .client_id ,
758
759
"scope" : scope ,
759
760
"token_endpoint" : self .configuration ["token_endpoint" ],
@@ -767,6 +768,7 @@ def obtain_token_by_refresh_token(self, token_item, scope=None,
767
768
rt_getter = lambda token_item : token_item ["refresh_token" ],
768
769
on_removing_rt = None ,
769
770
on_updating_rt = None ,
771
+ on_obtaining_tokens = None ,
770
772
** kwargs ):
771
773
# type: (Union[str, dict], Union[str, list, set, tuple], Callable) -> dict
772
774
"""This is an overload which will trigger token storage callbacks.
0 commit comments