You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If broker-related packages aren't installed and you try to use the authentication broker, you will get the error *ImportError: You need to install dependency by: pip install "msal[broker]>=1.20,<2"*.
30
30
31
-
Next, instantiate a new [*PublicClientApplication*](xref:msal.application.PublicClientApplication) and set *enable_broker_on_windows* to `True`. This will ensure that MSAL will try and communicate with WAM instead of popping up a new browser window. If you are writing a cross-platform application, you will also need to use *enable_broker_on_mac*, as outlined in the [Using MSAL Python with an Authentication Broker on macOS](macos-broker.md) article.
31
+
Next, instantiate a new [`PublicClientApplication`](xref:msal.application.PublicClientApplication) and set `enable_broker_on_windows` to `True`. This will ensure that MSAL will try and communicate with WAM instead of popping up a new browser window. If you are writing a cross-platform application, you will also need to use `enable_broker_on_mac`, as outlined in the [Using MSAL Python with an Authentication Broker on macOS](macos-broker.md) article.
32
32
33
33
```python
34
34
from msal import PublicClientApplication
@@ -39,7 +39,7 @@ app = PublicClientApplication(
39
39
enable_broker_on_windows=True)
40
40
```
41
41
42
-
You can now acquire a token by calling [*acquire_token_interactive*](xref:msal.application.PublicClientApplication.acquire_token_interactive) and specifying a parent window handle through *parent_window_handle*:
42
+
You can now acquire a token by calling [`acquire_token_interactive`](xref:msal.application.PublicClientApplication.acquire_token_interactive) and specifying a parent window handle through *parent_window_handle*:
43
43
44
44
```python
45
45
result = app.acquire_token_interactive(["User.ReadBasic.All"],
@@ -48,7 +48,7 @@ result = app.acquire_token_interactive(["User.ReadBasic.All"],
48
48
49
49
A parent window handle is required by WAM to ensure that the dialog is shown correctly on top of the requesting window. MSAL doesn't infer this directly due to the fact that there are many variables that might influence what window WAM needs to bind to, and developers building applications are best suited to decide what window that should be.
50
50
51
-
For console applications, MSAL makes it easy by offering an out-of-the-box solution to getting the window handle for the terminal - [*CONSOLE_WINDOW_HANDLE*](xref:msal.application.PublicClientApplication.CONSOLE_WINDOW_HANDLE). For desktop applications, more work with the Windows API might be required to [get the window handle](/windows/apps/develop/ui-input/retrieve-hwnd). Helper packages, like [pywin32](https://pypi.org/project/pywin32/) can help with API calls.
51
+
For console applications, MSAL makes it easy by offering an out-of-the-box solution to getting the window handle for the terminal - [`CONSOLE_WINDOW_HANDLE`](xref:msal.application.PublicClientApplication.CONSOLE_WINDOW_HANDLE). For desktop applications, more work with the Windows API might be required to [get the window handle](/windows/apps/develop/ui-input/retrieve-hwnd). Helper packages, like [pywin32](https://pypi.org/project/pywin32/) can help with API calls.
52
52
53
53
Before executing your application, make sure that you configure the redirect URL for the desktop app:
Copy file name to clipboardExpand all lines: msal-python-conceptual/index.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ After determining whether your application is a public or confidential client ap
58
58
59
59
Acquiring tokens with MSAL Python follows a three-step pattern. There will be some variations for different flows. If you would like to see them in action, download our [samples](https://github.com/AzureAD/microsoft-authentication-library-for-python/tree/dev/sample).
60
60
61
-
1. MSAL relies on a clean separation between public client and confidential client applications. Therefore, create either a [*PublicClientApplication*](xref:msal.application.PublicClientApplication) or a [*ConfidentialClientApplication*](xref:msal.application.ConfidentialClientApplication) instance and reuse it during the lifecycle of your application. For example, for a public client application, the initialization code might look like this:
61
+
1. MSAL relies on a clean separation between public client and confidential client applications. Therefore, create either a [`PublicClientApplication`](xref:msal.application.PublicClientApplication) or a [`ConfidentialClientApplication`](xref:msal.application.ConfidentialClientApplication) instance and reuse it during the lifecycle of your application. For example, for a public client application, the initialization code might look like this:
62
62
63
63
```python
64
64
from msal import PublicClientApplication
@@ -90,7 +90,7 @@ Acquiring tokens with MSAL Python follows a three-step pattern. There will be so
1. If there's no suitable token in the cache or you chose to skip the previous step, send a request to Microsoft Entra ID to get a token. There are different methods based on your client type and scenario, but for the purposes of the example we're showing how to use [*acquire_token_interactive*](xref:msal.application.PublicClientApplication.acquire_token_interactive), which prompts the user to provide their credentials.
93
+
1. If there's no suitable token in the cache or you chose to skip the previous step, send a request to Microsoft Entra ID to get a token. There are different methods based on your client type and scenario, but for the purposes of the example we're showing how to use [`acquire_token_interactive`](xref:msal.application.PublicClientApplication.acquire_token_interactive), which prompts the user to provide their credentials.
0 commit comments