Skip to content

Commit 370207b

Browse files
committed
Linux broker needs a specific redirect_uri
A recent customer troubleshooting case reveals that the Linux broker needs a specific redirect_uri as its prerequisite
1 parent db1c384 commit 370207b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

msal/application.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,8 +1948,6 @@ def __init__(
19481948
19491949
.. note::
19501950
1951-
You may set enable_broker_on_windows and/or enable_broker_on_mac and/or enable_broker_on_linux and/or enable_broker_on_wsl to True.
1952-
19531951
**What is a broker, and why use it?**
19541952
19551953
A broker is a component installed on your device.
@@ -1967,17 +1965,17 @@ def __init__(
19671965
so that your broker-enabled apps (even a CLI)
19681966
could automatically SSO from a previously established signed-in session.
19691967
1970-
**You shall only enable broker when your app:**
1968+
**You shall enable broker if your app meets these prerequisites:**
19711969
19721970
1. is running on supported platforms,
19731971
and already registered their corresponding redirect_uri
19741972
19751973
* ``ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id``
1976-
if your app is expected to run on Windows 10+
1974+
if your app is expected to run on Windows 10+ or WSL
19771975
* ``msauth.com.msauth.unsignedapp://auth``
1978-
if your app is expected to run on Mac
1979-
* ``ms-appx-web://Microsoft.AAD.BrokerPlugin/your_client_id``
1980-
if your app is expected to run on Linux, especially WSL
1976+
if your app is expected to run on Mac with Company Portal installed
1977+
* ``https://login.microsoftonline.com/common/oauth2/nativeclient``
1978+
if your app is expected to run on Linux with Intune installed
19811979
19821980
2. installed broker dependency,
19831981
e.g. ``pip install msal[broker]>=1.33,<2``.

msal/broker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ def _convert_error(error, client_id):
6060
or "AADSTS7000218" in context # This "request body must contain ... client_secret" is just a symptom of current app has no WAM redirect_uri
6161
):
6262
raise RedirectUriError( # This would be seen by either the app developer or end user
63-
"MsalRuntime needs the current app to register these redirect_uri "
64-
"(1) ms-appx-web://Microsoft.AAD.BrokerPlugin/{} (2) {}".format(
63+
"""MsalRuntime needs the current app to register these redirect_uri
64+
(1) ms-appx-web://Microsoft.AAD.BrokerPlugin/{}
65+
(2) {}
66+
(3) https://login.microsoftonline.com/common/oauth2/nativeclient""".format(
6567
client_id, _redirect_uri_on_mac))
6668
# OTOH, AAD would emit other errors when other error handling branch was hit first,
6769
# so, the AADSTS50011/RedirectUriError is not guaranteed to happen.

0 commit comments

Comments
 (0)