def _build_msal_app()

in PersonalAccessTokenAPIAppSample/app.py [0:0]


def _build_msal_app(cache=None, authority=None):
    CLIENT_SECRET = app_config.CLIENT_SECRET
    # To switch to using an environment variable to store the client secret, 
    # comment out the line above and replace with the following code block:

    # CLIENT_SECRET = os.getenv("CLIENT_SECRET")
    # if not CLIENT_SECRET:
    #     raise ValueError("Need to define CLIENT_SECRET environment variable")

    return msal.ConfidentialClientApplication(
        app_config.CLIENT_ID, authority=authority or app_config.AUTHORITY,
        client_credential=CLIENT_SECRET, token_cache=cache)