@@ -289,10 +289,7 @@ class initialization.
289289
290290 def __init__ (self ,
291291 client_id ,
292- on_obtaining_tokens =
293- lambda client_id = None , scope = None , token_endpoint = None ,
294- response = None , params = None , data = None , ** kwargs :
295- None ,
292+ on_obtaining_tokens = lambda event : None , # event is defined in _obtain_token(...)
296293 on_removing_rt = lambda token_item : None ,
297294 on_updating_rt = lambda token_item , new_rt : None ,
298295 ** kwargs ):
@@ -314,11 +311,14 @@ def _obtain_token(self, grant_type, params=None, data=None, *args, **kwargs):
314311 else :
315312 # TODO: Deal with absent scope in authorization grant
316313 scope = data .get ("scope" )
317- self .on_obtaining_tokens (
318- client_id = self .client_id ,
319- scope = scope ,
320- token_endpoint = self .configuration ["token_endpoint" ],
321- response = _resp , params = params , data = data )
314+ self .on_obtaining_tokens ({
315+ "client_id" : self .client_id ,
316+ "scope" : scope ,
317+ "token_endpoint" : self .configuration ["token_endpoint" ],
318+ "grant_type" : grant_type , # can be used to know an IdToken-less
319+ # response is for an app or for a user
320+ "response" : _resp , "params" : params , "data" : data ,
321+ })
322322 return resp
323323
324324 def obtain_token_with_refresh_token (self , token_item , scope = None ,
0 commit comments