Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acquire_token_interactive() allows customizing the redirect URI's path #593

Open
wants to merge 746 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
746 commits
Select commit Hold shift + click to select a range
7890783
Merge branch 'dot-env' into dev
rayluo Jul 23, 2021
dad2d5c
It was skipped and recently broken. Now it works.
rayluo Jul 30, 2021
c5e01c6
Merge branch 'worldwide-confidential-client-test' into dev
rayluo Jul 30, 2021
26252ce
Switch to github action badge
rayluo Jul 8, 2021
822661d
Merge branch 'switch-to-github-action-badge' into dev
rayluo Aug 1, 2021
6047d7d
Survive issue 387
rayluo Aug 4, 2021
aae2a87
Merge pull request #390 from AzureAD/fix-issue-387
rayluo Aug 4, 2021
8aa5d86
Merge in staged oauth2cli changes
rayluo Aug 5, 2021
807587e
Merge branch 'o2c' into dev
rayluo Aug 5, 2021
5ff2204
Merge remote-tracking branch 'oauth2cli_github/dev' into o2c
rayluo Aug 5, 2021
1457de4
Change regional endpoint doname name
rayluo Aug 10, 2021
e4adfef
Regional endpoint test cases do not rely on env var REGION_NAME
rayluo Aug 10, 2021
6d81ff1
REGION_NAME has no unified format across services
rayluo Aug 10, 2021
e9bd97f
Merge pull request #394 from AzureAD/region-endpoint-specs-changes
rayluo Aug 10, 2021
711f3cd
Prefer Edge when running on Linux
rayluo Jul 30, 2021
32a7ff3
Merge pull request #388 from AzureAD/prefer-edge-on-linux
rayluo Aug 19, 2021
1b386cb
An individual cache, after 3+ prototypes
rayluo May 7, 2020
b3098e8
ThrottledHttpClient
rayluo Jul 8, 2021
e538b02
Use throttled_http_client
rayluo Jul 8, 2021
649d515
Merge pull request #379 from AzureAD/http-cache
rayluo Aug 19, 2021
c8f3758
Convert staticmethod to module-wide public method
rayluo Aug 18, 2021
761073e
Merge branch 'refactor-token-cache-test-cases' into dev
rayluo Aug 19, 2021
7054e4e
Enable ThrottledHttpClient.close()
rayluo Aug 26, 2021
1849649
Merge branch 'http-cache' into dev
rayluo Aug 26, 2021
0dd87e4
MSAL Python 1.14
rayluo Aug 25, 2021
50de502
Merge pull request #401 from AzureAD/release-1.14.0
rayluo Aug 26, 2021
2483463
Implementing CCS Routing info
rayluo Aug 4, 2021
610da9c
Merge pull request #395 from AzureAD/ccs-routing-info
rayluo Sep 9, 2021
5041c77
Merge remote-tracking branch 'oauth2cli/dev' into ctrlc
rayluo Sep 9, 2021
0ffcd07
Merge pull request #404 from AzureAD/ctrlc
rayluo Sep 9, 2021
0c40195
Fix typos
jiasli Sep 1, 2021
d08d2da
Merge branch 'typo' into dev
rayluo Sep 10, 2021
24f1219
Merge remote-tracking branch 'oauth2cli/dev' into ctrlc
rayluo Sep 10, 2021
1bdf93b
Merge remote-tracking branch 'oauth2cli/dev' into max_age-and-validation
rayluo Sep 15, 2021
1c05a4d
Add max_age support https://stackoverflow.microsoft.com/questions/267…
rayluo Aug 3, 2021
bd6aa0d
Merge pull request #389 from AzureAD/max_age
rayluo Sep 15, 2021
a015d55
Map login_hint into CCS routing info, for now
rayluo Sep 29, 2021
788d3c8
Merge pull request #409 from AzureAD/ccs-routing
rayluo Sep 29, 2021
250c6d7
Bypass device authorization flow, for real
rayluo Sep 30, 2021
17126bb
Merge pull request #410 from AzureAD/http-cache
rayluo Sep 30, 2021
0d1417a
MSAL Python 1.15.0
rayluo Sep 30, 2021
9658d19
Bumping cryptography upper bound to X+3
rayluo Sep 30, 2021
fa615bf
Merge pull request #414 from AzureAD/bumping-cryptography-upper-bound
rayluo Oct 1, 2021
03d690d
Merge branch 'bumping-cryptography-upper-bound' into release-1.15.0
rayluo Oct 1, 2021
eecf1c1
Merge branch 'release-1.15.0' into dev
rayluo Oct 1, 2021
544e3e5
Expose http_cache parameter, with its docs and recipe.
rayluo Jul 8, 2021
78858f1
Merge pull request #407 from AzureAD/http-cache-parameter
rayluo Oct 15, 2021
fc5ff49
Merge remote-tracking branch 'oauth2cli_github/dev' into auth-code-re…
rayluo Oct 16, 2021
d8855eb
Merge remote-tracking branch 'oauth2cli/dev' into auth-code-receiver
rayluo Oct 21, 2021
ab72e9c
Merge remote-tracking branch 'oauth2cli/dev' into auth-code-receiver
rayluo Oct 27, 2021
2f1b48b
Adjusts the path
rayluo Oct 27, 2021
0c50d23
Merge pull request #427 from AzureAD/auth-code-receiver
rayluo Oct 28, 2021
2cbc14e
tests/authcode.py has long been obsolete
rayluo Oct 27, 2021
c2ffe94
Merge branch 'clean-up' into dev
rayluo Oct 28, 2021
7d1b03f
Re-enable REGION env var detection
rayluo Oct 6, 2021
f80b5c1
Change Regional Endpoint to require opt-in
rayluo Oct 22, 2021
be5f8f0
Merge pull request #425 from AzureAD/region-env-var
rayluo Oct 28, 2021
091a07d
MSAL Python 1.16.0
rayluo Oct 29, 2021
6ccc507
Merge pull request #430 from AzureAD/release-1.16.0
rayluo Oct 29, 2021
a81c355
Bubble up refresh exception when we cannot recover
rayluo Nov 2, 2021
425a908
Merge pull request #434 from AzureAD/bubble-up-refresh-exception
rayluo Nov 3, 2021
5271e1f
Lazy initialization makes partial test faster
rayluo Nov 5, 2021
3fa48d6
Merge branch 'refactor-test-application' into dev
rayluo Nov 5, 2021
7e2172a
Add cloud instances string constants
rayluo Nov 2, 2021
7ba324b
Merge pull request #433 from AzureAD/cloud-instances
rayluo Nov 9, 2021
8659b27
Fine tune http_cache usage pattern
rayluo Nov 10, 2021
515fbd2
Merge pull request #439 from AzureAD/http-cache-pattern
rayluo Nov 17, 2021
aee20e3
Descriptive error messages for troubleshooting
rayluo Nov 25, 2021
38563e0
Merge pull request #443 from AzureAD/authority-error-messages
rayluo Dec 1, 2021
88575d2
Document redirect_uri requirement inside sample
rayluo Dec 11, 2021
e7eee38
Merge remote-tracking branch 'oauth2cli/dev' into time-suggestion
rayluo Dec 28, 2021
4ca342d
Merge pull request #449 from AzureAD/time-suggestion
rayluo Dec 28, 2021
43c6280
Merge remote-tracking branch 'oauth2cli/dev' into time-suggestion
rayluo Jan 19, 2022
3879b90
Merge pull request #453 from AzureAD/time-suggestion
rayluo Jan 19, 2022
149360b
Lazy load dependencies
rayluo Jan 19, 2022
8e081d4
Merge pull request #454 from AzureAD/lazy-load
rayluo Jan 24, 2022
6264fd8
Document new info on how to detect edge on Linux
rayluo Jan 25, 2022
eb7c58b
Remove decommissioned domain to get tests working
rayluo Feb 2, 2022
9d48d29
Merge branch 'blackforest-decommission' into dev
rayluo Feb 2, 2022
31c7498
Change skip() to skipTest()
rayluo Feb 3, 2022
034b9ae
Actionable exception from ADFS ROPC
rayluo Feb 8, 2022
d2f0f14
Merge pull request #456 from AzureAD/actionable-runtime-error-for-adfs
rayluo Feb 9, 2022
e0b8a88
Removes the middle-layer exception
rayluo Feb 10, 2022
c0edde2
Merge pull request #458 from AzureAD/actionable-runtime-error-for-adfs
rayluo Feb 11, 2022
844c0ed
MSAL Python 1.17.0
rayluo Feb 8, 2022
f197234
Merge pull request #461 from AzureAD/release-1.17.0
rayluo Feb 11, 2022
997517a
Use absolute link for thumbnail in README
rayluo Feb 11, 2022
1e51ee3
Test matrix covers Python 3.10
rayluo Feb 9, 2022
42672d5
Test matrix covers Python 3.11
rayluo Feb 9, 2022
c7be0d8
Merge pull request #462 from AzureAD/more-py3-versions
rayluo Feb 14, 2022
cec910a
Fine tune some inline comments
rayluo Feb 14, 2022
599142f
Add an interactive console test script
rayluo Apr 19, 2022
2ae2d2c
Fine tune msaltest.py with prompt options
rayluo May 3, 2022
7d7a492
implement response_mode (#469)
eopeter May 12, 2022
0ef4a48
Automatically populate login_hint for easier tests
rayluo May 14, 2022
724746f
Merge branch 'msaltest' into dev
rayluo May 14, 2022
56d80c4
Emit warning when common or organizations is used in acquire_token_fo…
rayluo Nov 5, 2021
ead7d53
Merge pull request #435 from AzureAD/warning-in-acquire-token-for-client
rayluo May 17, 2022
669ac85
Acquire SSH cert from Cloud Shell IMDS
rayluo Oct 18, 2021
c644e57
MSAL Python 1.18.0b1
rayluo May 19, 2022
366e758
Fix typo in code
OvervCW May 30, 2022
a61ca7e
Merge pull request #420 from AzureAD/cloudshell-imds
rayluo May 31, 2022
dd79e93
Merge pull request #475 from AzureAD/release-1.18.0b1
rayluo May 31, 2022
8cb7f8b
MSAL Python 1.18.0
rayluo May 31, 2022
2e36358
Merge pull request #478 from AzureAD/release-1.18.0
rayluo May 31, 2022
a92a15b
Document our findings on addressing CVE-2022-29217
rayluo May 31, 2022
589c0be
Merge pull request #479 from AzureAD/pyjwt
rayluo May 31, 2022
bbd75fd
Disable test for China cloud
rayluo May 31, 2022
89b9da9
Merge branch 'disable-test-for-chinacloud' into dev
rayluo May 31, 2022
7f5bf64
Merge pull request #474 from OvervCW/patch-1
rayluo Jun 3, 2022
b74c08f
Merge remote-tracking branch 'oauth2cli/dev' into oauth2cli-dev
rayluo Jun 3, 2022
a995c05
Merge branch 'oauth2cli-dev' into dev
rayluo Jun 3, 2022
85f4f9e
Tolerate home_account_id to be None
rayluo Jun 8, 2022
6b709b0
Use provided authority port when building the tenant discovery endpoi…
sarathys Jun 29, 2022
0c885c4
Right regional endpoint for login.microsoft.com
rayluo Jun 17, 2022
a60c9a0
Merge pull request #485 from AzureAD/regional-microsoft-com
rayluo Jun 29, 2022
b553a51
Disable more tests for China cloud
rayluo Jun 29, 2022
46cea8a
Merge branch 'disable-test-for-china-cloud' into dev
rayluo Jun 29, 2022
ebfa0d5
Test latest 3.11 beta
tonybaloney Jul 25, 2022
94b53cf
Merge pull request #488 from tonybaloney/patch-2
rayluo Jul 26, 2022
cf6944c
Enable sphinx-paramlinks
rayluo Aug 25, 2022
d885927
Fix doc typo
rayluo Aug 26, 2022
980e898
Merge branch 'doc-param-links' into dev
rayluo Aug 26, 2022
95e523d
Broker (WAM) integration
rayluo Aug 29, 2022
bcefb10
Refine document
rayluo Aug 29, 2022
3773e00
Gracefully handle RuntimeError upfront
rayluo Sep 12, 2022
5ca97ee
Implement instance_discovery only
rayluo Sep 14, 2022
24d243f
Merge pull request #496 from AzureAD/instance-discovery-endpoint
rayluo Sep 19, 2022
a0a1286
MSAL Python 1.19.0
rayluo Sep 20, 2022
81b48ce
Bump up cryptography upperbound
rayluo Sep 20, 2022
45d0dc5
Merge pull request #501 from AzureAD/release-1.19.0
rayluo Sep 21, 2022
639f1b2
Test acquire_token_silent() for confidential client
rayluo Sep 21, 2022
f365f4e
Merge branch 'dev' into wam
rayluo Sep 28, 2022
11675e0
Adopt pymsalruntime 0.13
rayluo Sep 28, 2022
962fb0e
Remove automatic msa-pt for Azure CLI and Visual Studio
rayluo Sep 28, 2022
a08d6cd
Refactor test infrastructure to expose a known bug
rayluo Sep 30, 2022
3696acb
Add more docs
rayluo Oct 7, 2022
ac71fe8
Merge pull request #415 from AzureAD/wam
rayluo Oct 7, 2022
f9ff1a6
MSAL Python 1.20.0
rayluo Oct 7, 2022
0c73724
Update installation instruction
rayluo Oct 7, 2022
273868b
Merge pull request #504 from AzureAD/release-1.20.0
rayluo Oct 7, 2022
8026c02
Test matrix covers Python 3.11
rayluo Nov 2, 2022
efcb399
Merge pull request #512 from AzureAD/test-for-py3.11
rayluo Nov 3, 2022
c79d32e
Switch to new region endpoints
rayluo Nov 14, 2022
61e3ec8
Merge pull request #513 from AzureAD/new-region-endpoint
rayluo Nov 15, 2022
383fcfc
Test only Python versions available on github's ubuntu 22.04
rayluo Dec 8, 2022
4a93a6c
Merge branch 'update-ci' into dev
rayluo Dec 8, 2022
d0e4bb9
Cleaner skip declaration
rayluo Dec 9, 2022
fcb21b9
Merge branch 'refactor-e2e' into dev
rayluo Dec 9, 2022
14a4b79
Fallback to expires_on when expires_in is absent
rayluo Dec 8, 2022
eb8b71f
Merge pull request #519 from AzureAD/support_expires_on
rayluo Dec 9, 2022
6dc0fdd
Show lab api error, useful when trying api params
rayluo Jan 21, 2023
19d6aea
Merge branch 'lab-api-refactor' into dev
rayluo Jan 21, 2023
5dfe85e
Clarify when (not) to read API section
rayluo Oct 21, 2022
21bd422
Use broker for SSH Cert feature
rayluo Nov 10, 2022
918b93f
Merge pull request #515 from AzureAD/enable-msalruntime-for-ssh-cert
rayluo Jan 26, 2023
e8b52b7
Allow using client_id as scope. Needed by B2C.
rayluo Jan 27, 2023
8880918
Merge pull request #530 from AzureAD/allow-client_id-as-scope
rayluo Jan 30, 2023
206cf3e
Bump PyMsalRuntime to 0.13.2+
rayluo Jan 30, 2023
df5fefb
Merge branch 'use-pymsalruntime-0.13.2' into dev
rayluo Jan 31, 2023
8216e2c
MSAL Python 1.21.0
rayluo Jan 31, 2023
7593d08
Merge pull request #532 from AzureAD/release-1.21.0
rayluo Jan 31, 2023
e61e8a0
Remind user to use proper helper for ssh cert test
rayluo Jan 29, 2023
b277002
Merge branch 'refine-ssh-cert-test' into dev
rayluo Jan 30, 2023
7ecf651
point to correct quickstart
Dickson-Mwendia Feb 23, 2023
5cc9cd9
Merge pull request #537 from Dickson-Mwendia/update-doc-references
rayluo Feb 23, 2023
b9ac33f
Fix Markdown link
pamelafox Mar 2, 2023
a5fed26
Merge pull request #540 from pamelafox/patch-2
rayluo Mar 2, 2023
2fb3056
Remove effectiveless in-place clean
rayluo Feb 13, 2023
4673f4d
Merge branch 'cache-without-side-effect' into dev
rayluo Feb 15, 2023
0781ba1
Simplify and easier debugging
rayluo Feb 16, 2023
d4717ed
Merge branch 'refactor-oidc-discovery' into dev
rayluo Feb 17, 2023
8a429bd
Update setup.cfg with documentation URL (#539)
pamelafox Apr 6, 2023
ec4748d
Fix type introduced in #537
rayluo Feb 21, 2023
4b29298
Merge branch 'fix-docs-typo' into dev
rayluo Feb 23, 2023
078a573
Remove a deprecated attribute, scheduled for 1.21+
rayluo Feb 20, 2023
7e6a478
Merge pull request #547 from AzureAD/remove-deprecated-authority-http…
rayluo Apr 14, 2023
89ef015
CIAM end-to-end test cases based on new lab API
rayluo Dec 8, 2022
57c417b
Support https://contoso.ciamlogin.com as authority
rayluo Mar 1, 2023
ae7f40f
Bumping version numbers
rayluo Apr 4, 2023
74752cb
Merge pull request #520 from AzureAD/ciam
rayluo Apr 17, 2023
a0d0f0e
Merge branch 'release-1.22.0' into dev
rayluo Apr 7, 2023
a6023ea
Turns out they changed to a new tag for MSAL. Fix #539
rayluo Mar 30, 2023
d72409c
Merge branch 'fix-stackoverflow-link' into dev
rayluo Mar 31, 2023
a48e22b
Clarify that allow_broker is not applicable to ConfidentialClientAppl…
rayluo Mar 18, 2023
7d83e07
Merge pull request #559 from AzureAD/docs-staging
rayluo May 7, 2023
e1d2318
Merge remote-tracking branch 'oauth2cli/dev' into http-interface-polish
rayluo Mar 14, 2023
3517aed
No need for DummyHttpResponse
rayluo Mar 16, 2023
4a0eb39
Merge branch 'http-interface-polish' into dev
rayluo Mar 21, 2023
bc699f8
Adjustment for new CIAM partition
rayluo Apr 29, 2023
518d04e
Merge pull request #564 from AzureAD/ciam-in-new-partition
rayluo May 24, 2023
d4ca347
Improve logs
rayluo May 26, 2023
2638917
Merge branch 'improve-logs' into dev
rayluo May 30, 2023
634d328
Add more sections into TOC for the now long doc
rayluo May 31, 2023
6fe180f
Remove many Sphinx warnings
rayluo Jun 2, 2023
0d9050c
Merge branch 'docs-staging' into dev
rayluo Jun 6, 2023
97ec665
Github removes Python 2.7 support on 2023-6-19
rayluo Jun 8, 2023
d515d18
Merge branch 'fix-build-error' into dev
rayluo Jun 10, 2023
2184e50
Remove acquire_token_silent(..., account=None) usage in a backward-co…
rayluo Jun 29, 2023
0f635cd
Merge pull request #577 from AzureAD/silent-adjustment
rayluo Jul 22, 2023
0e5c685
Bumping up version numbers
rayluo Jul 12, 2023
7491207
Merge branch 'release-1.23.0' into dev
rayluo Jul 17, 2023
44df9c7
msaltest.py switches from confusing pprint to json
rayluo Jun 14, 2023
dfe4efa
Merge branch 'msaltest-json' into dev
rayluo Jun 15, 2023
76259f9
Switch from setup.py to setup.cfg
rayluo Jun 20, 2023
8d6d6c5
Ship release- branch of a non-draft PR to TestPyPI
rayluo Jun 21, 2023
54b65a2
Surface msal telemetry as a long opaque string
rayluo Jun 23, 2023
d98bb8f
Merge branch 'pipeline-adjustment' into dev
rayluo Jun 22, 2023
450ca64
Use a neutral name to hopefully avoid false alarm
rayluo Jul 24, 2023
4ae433d
Merge pull request #586 from AzureAD/avoid-false-alarm
rayluo Jul 27, 2023
4ca460f
Merge pull request #575 from AzureAD/msalruntime-telemetry
rayluo Aug 9, 2023
c943dc8
Fix typo in test names (warnning → warning)
musicinmybrain Aug 9, 2023
f5d2067
Merge pull request #588 from musicinmybrain/warnning
rayluo Aug 10, 2023
23e3ce2
Explicitly pip cache seems unnecessary
rayluo Jun 27, 2023
e90e36a
Merge branch 'simplify-workflow' into dev
rayluo Jun 28, 2023
546760d
Add enable_pii_log and wire it up with MsalRuntime
rayluo Aug 11, 2023
ca713b4
Merge pull request #590 from AzureAD/enable-pii
rayluo Aug 23, 2023
45d7682
Guarding against perf regression for acquire_token_for_client()
rayluo Jul 3, 2023
a3e6017
Add benchmark action and publish it to gh-pages
rayluo Jul 4, 2023
8d122f1
Merge pull request #580 from AzureAD/benchmark
rayluo Sep 6, 2023
dd9e090
Automatically check cryptography version
rayluo Aug 1, 2023
ae7cf14
Merge branch 'cryptography-ceiling' into dev
rayluo Aug 2, 2023
42516f5
Placeholders in some error will use curly brackets
rayluo Aug 22, 2023
e41b8f1
Merge branch 'improve-error-message' into dev
rayluo Aug 23, 2023
4850c81
Provide guidance on how to DIY the pkcs12-to-pem
rayluo Aug 24, 2023
8624982
Merge branch 'docs-staging' into dev
rayluo Aug 25, 2023
d788a88
Experimental: More precise regression detection
rayluo Aug 17, 2023
de3b757
Merge branch 'perf-baseline' into dev
rayluo Aug 28, 2023
0dd52f0
Refactor SshCert e2e test to use lab user
rayluo Aug 29, 2023
97152d8
E2E test for Azure CLI's connectedk8s AT POP
rayluo Aug 30, 2023
91f0b14
Add POP test function
rayluo Aug 31, 2023
dbd1508
Merge branch 'at-pop-with-external-key' into dev
rayluo Sep 1, 2023
4f146f7
Calls out that each commit triggers a TestPyPI release
rayluo Sep 4, 2023
62050de
Bumping version number
rayluo Sep 7, 2023
9a618ab
Merge branch 'release-1.24.0' into dev
rayluo Sep 11, 2023
841bb0b
CLI tester will be shipped with msal library
rayluo Sep 9, 2023
934414b
Merge branch 'tester' into dev
rayluo Sep 14, 2023
a4b76ab
Fix regression on input order for interactive test
rayluo Sep 10, 2023
1382469
Merge branch 'tester' into dev
rayluo Sep 16, 2023
affe78b
Merge remote-tracking branch 'oauth2cli/dev' into wip
rayluo Sep 3, 2023
0d9e07f
Bumping version number
rayluo Sep 26, 2023
1434c03
Merge branch 'release-1.24.1' into dev
rayluo Sep 29, 2023
82319cf
Mark package as supporting Python 3.12
tonybaloney Oct 6, 2023
a8e3811
Merge pull request #604 from tonybaloney/flag_312
rayluo Oct 6, 2023
e65781a
Remove x-client-cpu
rayluo Oct 6, 2023
593bcad
Merge pull request #605 from AzureAD/remove-x-client-cpu
rayluo Oct 11, 2023
a19f3e4
Resolve warnings node12 deprecation warnings
rayluo Sep 14, 2023
432ccc1
Merge branch 'upgrade-github-actions' into dev
rayluo Sep 21, 2023
83e3b8d
Support path in acquire_token_interactive
rayluo Oct 19, 2023
6cc1efa
Fix typo
rayluo Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to our [off-the-shelf samples](https://github.com/AzureAD/microsoft-authentication-library-for-python/tree/dev/sample) and pick one that is closest to your usage scenario. You should not need to modify the sample.
2. Follow the description of the sample, typically at the beginning of it, to prepare a `config.json` containing your test configurations
3. Run such sample, typically by `python sample.py config.json`
4. See the error
5. In this bug report, tell us the sample you choose, paste the content of the config.json with your test setup (which you can choose to skip your credentials, and/or mail it to our developer's email).

**Expected behavior**
A clear and concise description of what you expected to happen.

**What you see instead**
Paste the sample output, or add screenshots to help explain your problem.

**The MSAL Python version you are using**
Paste the output of this
`python -c "import msal; print(msal.__version__)"`

**Additional context**
Add any other context about the problem here.
123 changes: 123 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: CI/CD

on:
push:
pull_request:
branches: [ dev ]

# This guards against unknown PR until a community member vet it and label it.
types: [ labeled ]

jobs:
ci:
env:
# Fake a TRAVIS env so that the pre-existing test cases would behave like before
TRAVIS: true
LAB_APP_CLIENT_ID: ${{ secrets.LAB_APP_CLIENT_ID }}
LAB_APP_CLIENT_SECRET: ${{ secrets.LAB_APP_CLIENT_SECRET }}
LAB_OBO_CLIENT_SECRET: ${{ secrets.LAB_OBO_CLIENT_SECRET }}
LAB_OBO_CONFIDENTIAL_CLIENT_ID: ${{ secrets.LAB_OBO_CONFIDENTIAL_CLIENT_ID }}
LAB_OBO_PUBLIC_CLIENT_ID: ${{ secrets.LAB_OBO_PUBLIC_CLIENT_ID }}

# Derived from https://docs.github.com/en/actions/guides/building-and-testing-python#starting-with-the-python-workflow-template
runs-on: ubuntu-latest # It switched to 22.04 shortly after 2022-Nov-8
strategy:
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
# It automatically takes care of pip cache, according to
# https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#about-caching-workflow-dependencies
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: pytest --benchmark-skip
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
#flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

cb:
# Benchmark only after the correctness has been tested by CI,
# and then run benchmark only once (sampling with only one Python version).
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Setup an updatable cache for Performance Baselines
uses: actions/cache@v3
with:
path: .perf.baseline
key: ${{ runner.os }}-performance-${{ hashFiles('tests/test_benchmark.py') }}
restore-keys: ${{ runner.os }}-performance-
- name: Run benchmark
run: pytest --benchmark-only --benchmark-json benchmark.json --log-cli-level INFO tests/test_benchmark.py
- name: Render benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: 'pytest'
output-file-path: benchmark.json
fail-on-alert: true
- name: Publish Gibhub Pages
run: git push origin gh-pages

cd:
needs: ci
# Note: github.event.pull_request.draft == false WON'T WORK in "if" statement,
# because the triggered event is a push, not a pull_request.
# This means each commit will trigger a release on TestPyPI.
# Those releases will only succeed when each push has a new version number: a1, a2, a3, etc.
if: |
github.event_name == 'push' &&
(
startsWith(github.ref, 'refs/tags') ||
startsWith(github.ref, 'refs/heads/release-')
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build a package for release
run: |
python -m pip install build --user
python -m build --sdist --wheel --outdir dist/ .
- name: |
Publish to TestPyPI when pushing to release-* branch.
You better test with a1, a2, b1, b2 releases first.
uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/heads/release-')
with:
user: __token__
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI when tagged
if: startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ src/build

# Virtual Environments
/env*

.venv/
docs/_build/
# Visual Studio Files
/.vs/*
/tests/.vs/*
Expand All @@ -56,3 +57,6 @@ src/build
# The test configuration file(s) could potentially contain credentials
tests/config.json


.env
.perf.baseline
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,43 @@ python:
- "2.7"
- "3.5"
- "3.6"
# Borrowed from https://github.com/travis-ci/travis-ci/issues/9815
# Enable 3.7 without globally enabling sudo and dist: xenial for other build jobs
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
- python: 3.8
dist: xenial
sudo: true

install:
- pip install -r requirements.txt
script:
- python -m unittest discover -s tests

deploy:
- # test pypi
provider: pypi
distributions: "sdist bdist_wheel"
server: https://test.pypi.org/legacy/
user: "nugetaad"
password:
secure: KkjKySJujYxx31B15mlAZr2Jo4P99LcrMj3uON/X/WMXAqYVcVsYJ6JSzUvpNnCAgk+1hc24Qp6nibQHV824yiK+eG4qV+lpzkEEedkRx6NOW/h09OkT+pOSVMs0kcIhz7FzqChpl+jf6ZZpb13yJpQg2LoZIA4g8UdYHHFidWt4m5u1FZ9LPCqQ0OT3gnKK4qb0HIDaECfz5GYzrelLLces0PPwj1+X5eb38xUVtbkA1UJKLGKI882D8Rq5eBdbnDGsfDnF6oU+EBnGZ7o6HVQLdBgagDoVdx7yoXyntULeNxTENMTOZJEJbncQwxRgeEqJWXTTEW57O6Jo5uiHEpJA9lAePlRbS+z6BPDlnQogqOdTsYS0XMfOpYE0/r3cbtPUjETOmGYQxjQzfrFBfM7jaWnUquymZRYqCQ66VDo3I/ykNOCoM9qTmWt5L/MFfOZyoxLHnDThZBdJ3GXHfbivg+v+vOfY1gG8e2H2lQY+/LIMIJibF+MS4lJgrB81dcNdBzyxMNByuWQjSL1TY7un0QzcRcZz2NLrFGg8+9d67LQq4mK5ySimc6zdgnanuROU02vGr1EApT6D/qUItiulFgWqInNKrFXE9q74UP/WSooZPoLa3Du8y5s4eKerYYHQy5eSfIC8xKKDU8MSgoZhwQhCUP46G9Nsty0PYQc=
on:
branch: master
tags: false
condition: $TRAVIS_PYTHON_VERSION = "2.7"

- # production pypi
provider: pypi
distributions: "sdist bdist_wheel"
user: "nugetaad"
password:
secure: KkjKySJujYxx31B15mlAZr2Jo4P99LcrMj3uON/X/WMXAqYVcVsYJ6JSzUvpNnCAgk+1hc24Qp6nibQHV824yiK+eG4qV+lpzkEEedkRx6NOW/h09OkT+pOSVMs0kcIhz7FzqChpl+jf6ZZpb13yJpQg2LoZIA4g8UdYHHFidWt4m5u1FZ9LPCqQ0OT3gnKK4qb0HIDaECfz5GYzrelLLces0PPwj1+X5eb38xUVtbkA1UJKLGKI882D8Rq5eBdbnDGsfDnF6oU+EBnGZ7o6HVQLdBgagDoVdx7yoXyntULeNxTENMTOZJEJbncQwxRgeEqJWXTTEW57O6Jo5uiHEpJA9lAePlRbS+z6BPDlnQogqOdTsYS0XMfOpYE0/r3cbtPUjETOmGYQxjQzfrFBfM7jaWnUquymZRYqCQ66VDo3I/ykNOCoM9qTmWt5L/MFfOZyoxLHnDThZBdJ3GXHfbivg+v+vOfY1gG8e2H2lQY+/LIMIJibF+MS4lJgrB81dcNdBzyxMNByuWQjSL1TY7un0QzcRcZz2NLrFGg8+9d67LQq4mK5ySimc6zdgnanuROU02vGr1EApT6D/qUItiulFgWqInNKrFXE9q74UP/WSooZPoLa3Du8y5s4eKerYYHQy5eSfIC8xKKDU8MSgoZhwQhCUP46G9Nsty0PYQc=
on:
branch: master
tags: true
condition: $TRAVIS_PYTHON_VERSION = "2.7"

24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The MIT License (MIT)

Copyright (c) Microsoft Corporation.
All rights reserved.

This code is licensed under the MIT License.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
147 changes: 147 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Microsoft Authentication Library (MSAL) for Python

| `dev` branch | Reference Docs | # of Downloads per different platforms | # of Downloads per recent MSAL versions | Benchmark Diagram |
|:------------:|:--------------:|:--------------------------------------:|:---------------------------------------:|:-----------------:|
[![Build status](https://github.com/AzureAD/microsoft-authentication-library-for-python/actions/workflows/python-package.yml/badge.svg?branch=dev)](https://github.com/AzureAD/microsoft-authentication-library-for-python/actions) | [![Documentation Status](https://readthedocs.org/projects/msal-python/badge/?version=latest)](https://msal-python.readthedocs.io/en/latest/?badge=latest) | [![Downloads](https://static.pepy.tech/badge/msal)](https://pypistats.org/packages/msal) | [![Download monthly](https://static.pepy.tech/badge/msal/month)](https://pepy.tech/project/msal) | [📉](https://azuread.github.io/microsoft-authentication-library-for-python/dev/bench/)

The Microsoft Authentication Library for Python enables applications to integrate with the [Microsoft identity platform](https://aka.ms/aaddevv2). It allows you to sign in users or apps with Microsoft identities ([Azure AD](https://azure.microsoft.com/services/active-directory/), [Microsoft Accounts](https://account.microsoft.com) and [Azure AD B2C](https://azure.microsoft.com/services/active-directory-b2c/) accounts) and obtain tokens to call Microsoft APIs such as [Microsoft Graph](https://graph.microsoft.io/) or your own APIs registered with the Microsoft identity platform. It is built using industry standard OAuth2 and OpenID Connect protocols

Not sure whether this is the SDK you are looking for your app? There are other Microsoft Identity SDKs
[here](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki/Microsoft-Authentication-Client-Libraries).

Quick links:

| [Getting Started](https://learn.microsoft.com/azure/active-directory/develop/web-app-quickstart?pivots=devlang-python)| [Docs](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki) | [Samples](https://aka.ms/aaddevsamplesv2) | [Support](README.md#community-help-and-support) | [Feedback](https://forms.office.com/r/TMjZkDbzjY) |
| --- | --- | --- | --- | --- |

## Scenarios supported

Click on the following thumbnail to visit a large map with clickable links to proper samples.

[![Map effect won't work inside github's markdown file, so we have to use a thumbnail here to lure audience to a real static website](https://raw.githubusercontent.com/AzureAD/microsoft-authentication-library-for-python/dev/docs/thumbnail.png)](https://msal-python.readthedocs.io/en/latest/)

## Installation

You can find MSAL Python on [Pypi](https://pypi.org/project/msal/).
1. If you haven't already, [install and/or upgrade the pip](https://pip.pypa.io/en/stable/installing/)
of your Python environment to a recent version. We tested with pip 18.1.
2. As usual, just run `pip install msal`.

## Versions

This library follows [Semantic Versioning](http://semver.org/).

You can find the changes for each version under
[Releases](https://github.com/AzureAD/microsoft-authentication-library-for-python/releases).

## Usage

Before using MSAL Python (or any MSAL SDKs, for that matter), you will have to
[register your application with the Microsoft identity platform](https://docs.microsoft.com/azure/active-directory/develop/quickstart-v2-register-an-app).

Acquiring tokens with MSAL Python follows this 3-step pattern.
(Note: That is the high level conceptual pattern.
There will be some variations for different flows. They are demonstrated in
[runnable samples hosted right in this repo](https://github.com/AzureAD/microsoft-authentication-library-for-python/tree/dev/sample).
)


1. MSAL proposes a clean separation between
[public client applications, and confidential client applications](https://tools.ietf.org/html/rfc6749#section-2.1).
So you will first create either a `PublicClientApplication` or a `ConfidentialClientApplication` instance,
and ideally reuse it during the lifecycle of your app. The following example shows a `PublicClientApplication`:

```python
from msal import PublicClientApplication
app = PublicClientApplication(
"your_client_id",
authority="https://login.microsoftonline.com/Enter_the_Tenant_Name_Here")
```

Later, each time you would want an access token, you start by:
```python
result = None # It is just an initial value. Please follow instructions below.
```

2. The API model in MSAL provides you explicit control on how to utilize token cache.
This cache part is technically optional, but we highly recommend you to harness the power of MSAL cache.
It will automatically handle the token refresh for you.

```python
# We now check the cache to see
# whether we already have some accounts that the end user already used to sign in before.
accounts = app.get_accounts()
if accounts:
# If so, you could then somehow display these accounts and let end user choose
print("Pick the account you want to use to proceed:")
for a in accounts:
print(a["username"])
# Assuming the end user chose this one
chosen = accounts[0]
# Now let's try to find a token in cache for this account
result = app.acquire_token_silent(["your_scope"], account=chosen)
```

3. Either there is no suitable token in the cache, or you chose to skip the previous step,
now it is time to actually send a request to AAD to obtain a token.
There are different methods based on your client type and scenario. Here we demonstrate a placeholder flow.

```python
if not result:
# So no suitable token exists in cache. Let's get a new one from AAD.
result = app.acquire_token_by_one_of_the_actual_method(..., scopes=["User.Read"])
if "access_token" in result:
print(result["access_token"]) # Yay!
else:
print(result.get("error"))
print(result.get("error_description"))
print(result.get("correlation_id")) # You may need this when reporting a bug
```

Refer the [Wiki](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki) pages for more details on the MSAL Python functionality and usage.

## Migrating from ADAL

If your application is using ADAL Python, we recommend you to update to use MSAL Python. No new feature work will be done in ADAL Python.

See the [ADAL to MSAL migration](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki/Migrate-to-MSAL-Python) guide.

## Roadmap

You can follow the latest updates and plans for MSAL Python in the [Roadmap](https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki/Roadmap) published on our Wiki.

## Samples and Documentation

MSAL Python supports multiple [application types and authentication scenarios](https://docs.microsoft.com/azure/active-directory/develop/authentication-flows-app-scenarios).
The generic documents on
[Auth Scenarios](https://docs.microsoft.com/azure/active-directory/develop/authentication-scenarios)
and
[Auth protocols](https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols)
are recommended reading.

We provide a [full suite of sample applications](https://aka.ms/aaddevsamplesv2) and [documentation](https://aka.ms/aaddevv2) to help you get started with learning the Microsoft identity platform.

## Community Help and Support

We leverage Stack Overflow to work with the community on supporting Azure Active Directory and its SDKs, including this one!
We highly recommend you ask your questions on Stack Overflow (we're all on there!)
Also browser existing issues to see if someone has had your question before.

We recommend you use the "msal" tag so we can see it!
Here is the latest Q&A on Stack Overflow for MSAL:
[http://stackoverflow.com/questions/tagged/msal](http://stackoverflow.com/questions/tagged/msal)

## Submit Feedback
We'd like your thoughts on this library. Please complete [this short survey.](https://forms.office.com/r/TMjZkDbzjY)

## Security Reporting

If you find a security issue with our libraries or services please report it to [[email protected]](mailto:[email protected]) with as much detail as possible. Your submission may be eligible for a bounty through the [Microsoft Bounty](http://aka.ms/bugbounty) program. Please do not post security issues to GitHub Issues or any other public site. We will contact you shortly upon receiving the information. We encourage you to get notifications of when security incidents occur by visiting [this page](https://technet.microsoft.com/security/dd252948) and subscribing to Security Advisory Alerts.

## Contributing

All code is licensed under the MIT license and we triage actively on GitHub. We enthusiastically welcome contributions and feedback. Please read the [contributing guide](./contributing.md) before starting.

## We Value and Adhere to the Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
Loading
Loading