improve token fetch

This commit is contained in:
2024-06-24 21:24:34 +02:00
parent ee3d9caf4e
commit cc49757545
2 changed files with 4 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ WORKDIR /app
COPY ./propedal-planner /app
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install -r requirements.txt
# Make port available to the world outside this container
EXPOSE 8001

View File

@@ -13,6 +13,8 @@ except ImportError:
from backports.zoneinfo import ZoneInfo
WEEKDAYS= {0:"Mo", 1:"Di", 2:"Mi", 3:"Do", 4: "Fr", 5:"Sa", 6: "So"}
result = None
# Optional logging
# logging.getLogger("msal").setLevel(logging.INFO) # Optionally disable MSAL DEBUG logs
@@ -27,10 +29,9 @@ app = msal.ConfidentialClientApplication(
)
def get_access_token():
global app
global app, result
# The pattern to acquire a token looks like this.
result = None
# Firstly, looks up a token from cache
# Since we are looking for token for the current app, NOT for an end user,