Skip to content

Commit be5ce12

Browse files
Merge pull request #214750 from derisen/patch-14
Add remark for B2C use cases, add section for negating SSO
2 parents f07b723 + bc6f0b4 commit be5ce12

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

articles/active-directory/develop/msal-js-sso.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ When a user authenticates, a session cookie is set on the Azure AD domain in the
5050
To improve performance and ensure that the authorization server will look for the correct account session, you can pass one of the following options in the request object of the `ssoSilent` method to obtain the token silently.
5151

5252
- Session ID `sid` (which can be retrieved from `idTokenClaims` of an `account` object)
53-
- `login_hint` (which can be retrieved from the `account` object username property or the `upn` claim in the ID token)
53+
- `login_hint` (which can be retrieved from the `account` object username property or the `upn` claim in the ID token) (if your app is authenticating users with B2C, see: [Configure B2C user-flows to emit username in ID tokens](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/FAQ.md#why-is-getaccountbyusername-returning-null-even-though-im-signed-in) )
5454
- `account` (which can be retrieved from using one the [account methods](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/login-user.md#account-apis))
5555

5656
#### Using a session ID
@@ -183,11 +183,13 @@ InteractionRequiredAuthError: login_required: AADSTS50058: A silent sign-in requ
183183

184184
To resolve the error, the user must create an interactive authentication request using the `loginPopup()` or `loginRedirect()`. In some cases, the prompt value **none** can be used together with an interactive MSAL.js method to achieve SSO. See [Interactive requests with prompt=none](msal-js-prompt-behavior.md#interactive-requests-with-promptnone) for more. If you already have the user's sign-in information, you can pass either the `loginHint` or `sid` optional parameters to sign-in a specific account.
185185

186-
## SSO in ADAL.js to MSAL.js update
186+
## Negating SSO with prompt=login
187187

188-
MSAL.js brings feature parity with ADAL.js for Azure AD authentication scenarios. To make the migration from ADAL.js to MSAL.js easy and to avoid prompting your users to sign in again, the library reads the ID token representing user’s session in ADAL.js cache, and seamlessly signs in the user in MSAL.js.
188+
If you like Azure AD to prompt the user for entering their credentials despite there being an active session with the authorization server, you can use the **login** prompt parameter in requests with MSAL.js. See [MSAL.js prompt behavior](msal-js-prompt-behavior.md) for more.
189189

190-
To take advantage of the SSO behavior when updating from ADAL.js, you'll need to ensure the libraries are using `localStorage` for caching tokens. Set the `cacheLocation` to `localStorage` in both the MSAL.js and ADAL.js configuration at initialization as follows:
190+
## Sharing authentication state between ADAL.js and MSAL.js
191+
192+
MSAL.js brings feature parity with ADAL.js for Azure AD authentication scenarios. To make the migration from ADAL.js to MSAL.js easy and share authentication state between apps, the library reads the ID token representing user’s session in ADAL.js cache. To take advantage of this when migrating from ADAL.js, you'll need to ensure that the libraries are using `localStorage` for caching tokens. Set the `cacheLocation` to `localStorage` in both the MSAL.js and ADAL.js configuration at initialization as follows:
191193

192194
```javascript
193195

@@ -212,8 +214,6 @@ const config = {
212214
const msalInstance = new msal.PublicClientApplication(config);
213215
```
214216

215-
Once the `cacheLocation` is configured, MSAL.js can read the cached state of the authenticated user in ADAL.js and use that to provide SSO in MSAL.js.
216-
217217
## Next steps
218218

219219
For more information about SSO, see:

0 commit comments

Comments
 (0)