Skip to content

Samples: incorrect/misleading cached token lookup using account=None #30

Description

In the 1-Call-MsGraph-WithSecret sample, the comments explain that calling app.acquire_token_silent will look up a token from cache (source).

# Firstly, looks up a token from cache
# Since we are looking for token for the current app, NOT for an end user,
# notice we give account parameter as None.
result = app.acquire_token_silent(config["scope"], account=None)

However, the current behavior of the acquire_token_silent function will immediately return None if the account parameter is provided as None as given in the sample (source).

    def acquire_token_silent(
            self,
            scopes,  # type: List[str]
            account,  # type: Optional[Account]
        ...
        if not account:
            return None  # A backward-compatible NO-OP to drop the account=None usage

Can the sample be updated to show how to properly retrieve a cached token?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions