Skip to content

Commit 85bf185

Browse files
Merge pull request #135 from Ugonnaak1/akaliugonna/deprecateRopcFlow
Deprecate Ropc flow in docs
2 parents 1b5879a + be7971f commit 85bf185

File tree

4 files changed

+21
-12
lines changed

4 files changed

+21
-12
lines changed

msal-python-conceptual/advanced/aad-b2c.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ ms.topic: how-to
1010
ms.date: 02/07/2024
1111
ms.author: dmwendia
1212
ms.reviewer: shermanouko, rayluo
13-
#Customer intent:
13+
#Customer intent:
1414
---
15-
1615
# Use MSAL Python to work with Azure AD B2C
1716

1817
You can use MSAL Python to sign-in users with social identities, acquire tokens, and customize the sign-in experience by using [Azure AD B2C](https://aka.ms/aadb2c).
@@ -71,7 +70,7 @@ doubles as a B2C web app sample. Its major file `app.py` works on both non-B2C a
7170
app.acquire_token_by_xyz(...) # Same as in non-B2C scenarios
7271
```
7372

74-
> There is no need to filter accounts by user flow,
73+
There is no need to filter accounts by user flow,
7574
as long as you are following a pattern of
7675
"create different MSAL app for different user flow"
7776
(because the B2C user flow is designed to behave like an isolated authority).
@@ -101,15 +100,17 @@ You would just need to update your HTML template to include new link to, for exa
101100
```
102101

103102
## Resource Owner Password Credentials (ROPC) With B2C
103+
>[!WARNING]
104+
>The Resource Owner Password Credential (ROPC) flow has been deprecated for public client applications due to security risks. Microsoft recommends using a more secure authentication flow. Follow the official guidance on how to [Migrate from ROPC](https://aka.ms/msal-ropc-migration).
104105
105106
There exists no API difference between a B2C and non-B2C scenario. The following content serves as a mini-tutorial.
106107

107108
* In your Azure AD B2C tenant, create a new user flow and select **Sign in using ROPC**.
108-
This will enable the ROPC user flow for your tenant.
109-
See [Configure the resource owner password credentials flow](/azure/active-directory-b2c/configure-ropc) for more details.
109+
This will enable the ROPC user flow for your tenant.
110+
See [Configure the resource owner password credentials flow](/azure/active-directory-b2c/configure-ropc) for more details.
110111
* Once you create the MSAL instance with the authority which contains the ROPC user flow,
111-
the [`acquire_token_by_username_password(...)`](https://msal-python.readthedocs.io/en/latest/#msal.PublicClientApplication.acquire_token_by_username_password)
112-
would work as usual.
112+
the [`acquire_token_by_username_password(...)`](https://msal-python.readthedocs.io/en/latest/#msal.PublicClientApplication.acquire_token_by_username_password)
113+
would work as usual.
113114
* Limitations: This **only works for local accounts** (where you register with B2C using an email or username). This flow does not work if federating to any of the IdPs supported by B2C (Facebook, Google, etc...).
114115

115116
Microsoft [discourages the use of resource owner password credentials grant](https://news.microsoft.com/features/whats-solution-growing-problem-passwords-says-microsoft/). In most scenarios, more secure alternatives are available and recommended. This flow requires a very high degree of trust in the application, and carries risks that are not present in other flows. You should only use this flow when other more secure flows aren't viable. Learn more in the [username and password ](username-password-authentication.md) guidance.
@@ -122,7 +123,7 @@ MSAL Python token cache usage pattern starts with querying all existing accounts
122123
[`get_accounts(...)`, which supports a `username` parameter as filter](https://msal-python.readthedocs.io/en/latest/#msal.ClientApplication.get_accounts).
123124
That username data is populated by a `preferred_username` claim inside the ID Token.
124125

125-
By default, that claim is missing in many of the Azure AD B2C scenarios.
126+
By default, that claim is missing in many of the Azure AD B2C scenarios.
126127

127128
The customer impact is that when trying to display the accounts, their username field would be empty.
128129
This may not bother you, if you are using Auth Code flow in your web app, and dealing with only one account per user.
@@ -135,6 +136,6 @@ or simply call your `app.get_accounts()` without a specific username parameter.
135136

136137
## Samples
137138

138-
Sample | Platform | Description
139-
------ | -------- | -----------
140-
[Microsoft Identity Python Web App](https://github.com/Azure-Samples/ms-identity-python-webapp) | All platforms supporting Python | A web app showcasing how to use MSAL Python to authenticate users via Azure Active Directory B2C, and access a Web API with the resulting tokens.
139+
| Sample | Platform | Description |
140+
| -------------------------------------------------------------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
141+
| [Microsoft Identity Python Web App](https://github.com/Azure-Samples/ms-identity-python-webapp) | All platforms supporting Python | A web app showcasing how to use MSAL Python to authenticate users via Azure Active Directory B2C, and access a Web API with the resulting tokens. |

msal-python-conceptual/advanced/msal-python-adfs-support.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ The supported AD FS versions in this federated scenario are:
3939
- Active Directory Federation Services v4 (AD FS 2016)
4040

4141
### Acquire a token via username and password
42+
>[!WARNING]
43+
>The Resource Owner Password Credential (ROPC) flow has been deprecated for public client applications due to security risks. Microsoft recommends using a more secure authentication flow. Follow the official guidance on how to [Migrate from ROPC](https://aka.ms/msal-ropc-migration).
4244
4345
The following applies whether you connect directly to Active Directory Federation Services (AD FS) or through Active Directory.
4446

msal-python-conceptual/advanced/username-password-authentication.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ms.custom: sfi-image-nochange
1515

1616
# Username and password authentication
1717

18+
>[!WARNING]
19+
>The Resource Owner Password Credential (ROPC) flow has been deprecated for public client applications due to security risks. Microsoft recommends using a more secure authentication flow. Follow the official guidance on how to [Migrate from ROPC](https://aka.ms/msal-ropc-migration).
20+
1821
The content below are applicable to [all MSAL libraries](/entra/msal), not just MSAL Python.
1922

2023
## The username and password flow is not recommended

msal-python-conceptual/getting-started/acquiring-tokens.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,12 @@ else:
123123

124124
### Username and password
125125

126+
>[!WARNING]
127+
> This api has been deprecated for public client flows due to security risks, use a more secure flow. Follow [this guide](https://aka.ms/msal-ropc-migration) for migration guidance.
128+
126129
We don't recommend using this approach. It's also possible to get a token with a [username and password](/entra/identity-platform/v2-oauth-ropc). MSAL Python provides the [`acquire_token_by_username_password`](/python/api/msal/msal.application.clientapplication#msal-application-clientapplication-acquire-token-by-username-password) method for this use case. It's not recommended because the application will be asking a user for their password directly, which is an insecure pattern.
127130

128-
Microsoft doesn't recommend the username and password flow because the application will be asking a user for their password directly, which is an insecure pattern. In most scenarios, there exist more secure flows that you can use. Learn more in the [username and password authentication flow](../advanced/username-password-authentication.md) guidance.
131+
There are more secure flows that you can use. Learn more in the [username and password authentication flow](../advanced/username-password-authentication.md) guidance.
129132

130133
```python
131134
result = app.acquire_token_by_username_password(

0 commit comments

Comments
 (0)