Samples: incorrect/misleading cached token lookup using `account=None`
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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure-Samples/ms-identity-python-daemon
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
Azure-Samples/ms-identity-python-daemon#23 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
All issues in Azure-Samples/ms-identity-python-daemon
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
siyuan-note/siyuan#20313 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 76/100
ethereum/execution-apis#935 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
infinispan/langchain-infinispan#34 ·
Maintainers usually reply within 1 day
-
[docs] Media elements cannot load from a custom protocol (video/audio report MEDIA_ERR_SRC_NOT_SUPPORTED)Possibly taken @vst93 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day