How to use the paconn.authentication.tokenmanager.TokenManager function in paconn

To help you get started, we’ve selected a few paconn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / authentication / auth.py View on Github external
def get_authentication(settings, force_authenticate):
    """
    Logs the user in and saves the token in a file.
    """
    tokenmanager = TokenManager()
    credentials = tokenmanager.read()

    token_expired = TokenManager.is_expired(credentials)

    # Get new token
    if token_expired or force_authenticate:
        profile = Profile(
            client_id=settings.client_id,
            tenant=settings.tenant,
            resource=settings.resource,
            authority_url=settings.authority_url)

        credentials = profile.authenticate_device_code()

        tokenmanager.write(credentials)
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / settings / util.py View on Github external
def load_powerapps_and_flow_rp(settings, command_context):

    # Get credentials
    credentials = TokenManager().get_credentials()

    # Get powerapps rp
    powerapps_rp = PowerAppsRPBuilder.get_from_settings(
        credentials=credentials,
        settings=settings)

    # Get flow rp
    flow_rp = FlowRPBuilder.get_from_settings(
        credentials=credentials,
        settings=settings)

    # If the file names are missing for the download command
    # use default names
    if command_context is _DOWNLOAD:
        settings.api_properties = settings.api_properties or 'apiProperties.json'
        settings.api_definition = settings.api_definition or 'apiDefinition.swagger.json'