File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -282,10 +282,24 @@ def __init__(
282282
283283 self .app_name = app_name
284284 self .app_version = app_version
285- self .authority = Authority (
285+
286+ # Here the self.authority will not be the same type as authority in input
287+ try :
288+ self .authority = Authority (
286289 authority or "https://login.microsoftonline.com/common/" ,
287290 self .http_client , validate_authority = validate_authority )
288- # Here the self.authority is not the same type as authority in input
291+ except ValueError : # Those are explicit authority validation errors
292+ raise
293+ except Exception : # The rest are typically connection errors
294+ if validate_authority and region :
295+ # Since caller opts in to use region, here we tolerate connection
296+ # errors happened during authority validation at non-region endpoint
297+ self .authority = Authority (
298+ authority or "https://login.microsoftonline.com/common/" ,
299+ self .http_client , validate_authority = False )
300+ else :
301+ raise
302+
289303 self .token_cache = token_cache or TokenCache ()
290304 self ._region_configured = region
291305 self ._region_detected = None
You can’t perform that action at this time.
0 commit comments