Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#30 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
documentation

Research direction

Start with 1-Call-MsGraph-WithSecret/confidential_client_secret_sample.py and read the linked acquire_token_silent behavior in MSAL for Python. Update the sample so its comments and token-cache lookup demonstrate the proper approach, then verify that the sample's cached-token flow is consistent with the documented behavior.

Written by the indexing model from the issue text.

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?

Dominant language
PowerShell
Stars
62
Forks
27
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Azure-Samples/ms-identity-python-daemon

All issues in Azure-Samples/ms-identity-python-daemon

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.