From cb3c10297dc528fe8ac36851ccc94d2810c6ca30 Mon Sep 17 00:00:00 2001 From: Raymond Wiker Date: Wed, 18 Sep 2024 11:56:54 +0200 Subject: [PATCH] Don't try to use AuthProviderSilent if there is no token cache file. --- src/sumo/wrapper/_auth_provider.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sumo/wrapper/_auth_provider.py b/src/sumo/wrapper/_auth_provider.py index 0e35a57..00c12b4 100644 --- a/src/sumo/wrapper/_auth_provider.py +++ b/src/sumo/wrapper/_auth_provider.py @@ -406,10 +406,12 @@ def get_auth_provider( if os.path.exists(get_token_path(resource_id, ".sharedkey")): return AuthProviderSumoToken(resource_id) # ELSE - auth_silent = AuthProviderSilent(client_id, authority, resource_id) - token = auth_silent.get_token() - if token is not None: - return auth_silent + if os.path.exists(get_token_path(resource_id, ".token")): + auth_silent = AuthProviderSilent(client_id, authority, resource_id) + token = auth_silent.get_token() + if token is not None: + return auth_silent + pass # ELSE if interactive: return AuthProviderInteractive(client_id, authority, resource_id)