File tree Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Expand file tree Collapse file tree 2 files changed +26
-6
lines changed Original file line number Diff line number Diff line change @@ -419,12 +419,15 @@ def refresh_token(
419
419
)
420
420
kwargs .update (self .auto_refresh_kwargs )
421
421
422
- auth = auth or kwargs .pop (' auth' , None )
423
- client_id = kwargs .get (' client_id' )
424
- client_secret = kwargs .get (' client_secret' , '' )
422
+ auth = auth or kwargs .pop (" auth" , None )
423
+ client_id = kwargs .get (" client_id" )
424
+ client_secret = kwargs .get (" client_secret" , "" )
425
425
426
426
if client_id and (auth is None ):
427
- log .debug ('Encoding client_id "%s" with client_secret as Basic auth credentials.' , client_id )
427
+ log .debug (
428
+ 'Encoding client_id "%s" with client_secret as Basic auth credentials.' ,
429
+ client_id ,
430
+ )
428
431
auth = requests .auth .HTTPBasicAuth (client_id , client_secret )
429
432
430
433
body = self ._client .prepare_refresh_body (
@@ -501,8 +504,10 @@ def request(
501
504
)
502
505
503
506
token = self .refresh_token (
504
- self .auto_refresh_url , client_id = client_id ,
505
- client_secret = client_secret , ** kwargs
507
+ self .auto_refresh_url ,
508
+ client_id = client_id ,
509
+ client_secret = client_secret ,
510
+ ** kwargs
506
511
)
507
512
if self .token_updater :
508
513
log .debug (
Original file line number Diff line number Diff line change @@ -194,6 +194,21 @@ def fake_refresh_with_auth(r, **kwargs):
194
194
client_secret = self .client_secret ,
195
195
)
196
196
197
+ # auto refresh with auth from auto_refresh_kwargs
198
+ for client in self .clients :
199
+ sess = OAuth2Session (
200
+ client = client ,
201
+ token = self .expired_token ,
202
+ auto_refresh_url = "https://i.b/refresh" ,
203
+ token_updater = token_updater ,
204
+ auto_refresh_kwargs = {
205
+ "client_id" : self .client_id ,
206
+ "client_secret" : self .client_secret ,
207
+ },
208
+ )
209
+ sess .send = fake_refresh_with_auth
210
+ sess .get ("https://i.b" )
211
+
197
212
@mock .patch ("time.time" , new = lambda : fake_time )
198
213
def test_token_from_fragment (self ):
199
214
mobile = MobileApplicationClient (self .client_id )
You can’t perform that action at this time.
0 commit comments