Revert account selecton
This commit is contained in:
@@ -30,17 +30,15 @@ app = msal.ConfidentialClientApplication(
|
|||||||
# You can learn how to use SerializableTokenCache from
|
# You can learn how to use SerializableTokenCache from
|
||||||
# https:#msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
|
# https:#msal-python.readthedocs.io/en/latest/#msal.SerializableTokenCache
|
||||||
)
|
)
|
||||||
accounts = app.get_accounts(username=None)
|
|
||||||
|
|
||||||
def get_access_token():
|
def get_access_token():
|
||||||
global app, token, accounts
|
global app, token
|
||||||
|
|
||||||
# The pattern to acquire a token looks like this.
|
# The pattern to acquire a token looks like this.
|
||||||
|
|
||||||
# Firstly, looks up a token from cache
|
# Firstly, looks up a token from cache
|
||||||
# Since we are looking for token for the current app, NOT for an end user,
|
# Since we are looking for token for the current app, NOT for an end user,
|
||||||
# notice we give account parameter as None.
|
# notice we give account parameter as None.
|
||||||
token = app.acquire_token_silent(MsalConfig.SCOPE, account=accounts[0])
|
token = app.acquire_token_silent(MsalConfig.SCOPE, account=None)
|
||||||
|
|
||||||
if token is None:
|
if token is None:
|
||||||
logging.info("No suitable token exists in cache. Let's get a new one from AAD.")
|
logging.info("No suitable token exists in cache. Let's get a new one from AAD.")
|
||||||
|
|||||||
Reference in New Issue
Block a user