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
Add allowPlatformBrokerWithDOM experimental config flag (#8589)
Add experimental config flag 'allowPlatformBrokerWithDOM' under
BrowserExperimentalOptions to enable platform broker support through DOM
APIs in Edge. When both allowPlatformBroker and
allowPlatformBrokerWithDOM are set, MSAL first checks for DOM API
availability before falling back to PlatformAuthExtensionHandler.
- Add allowPlatformBrokerWithDOM to BrowserExperimentalOptions (default:
false)
- Replace session storage-based isDomEnabledForPlatformAuth with
explicit config parameter
- Add invalidPlatformBrokerConfiguration error code for invalid config
combinations
- Add config validation in isPlatformAuthAllowed
- Pass config flag through StandardController to getPlatformAuthProvider
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lalimasharda <26092202+lalimasharda@users.noreply.github.com>
Co-authored-by: Thomas Norling <thomas.norling@microsoft.com>
Copy file name to clipboardExpand all lines: docs/errors.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -261,6 +261,10 @@ This error occurs when MSAL.js surpasses the allotted storage limit when attempt
261
261
262
262
- Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.
263
263
264
+
### `invalid_platform_broker_configuration`
265
+
266
+
- Invalid platform broker configuration. `allowPlatformBrokerWithDOM` requires `allowPlatformBroker` to also be set to `true`.
267
+
264
268
### `authority_mismatch`
265
269
266
270
- Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.
// Warning: (ae-missing-release-tag) "BrowserPerformanceClient" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
@@ -911,13 +912,10 @@ function isInIframe(): boolean;
911
912
// @public
912
913
function isInPopup():boolean;
913
914
914
-
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
915
-
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
916
-
// Warning: (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
917
915
// Warning: (ae-missing-release-tag) "isPlatformBrokerAvailable" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "IWindowStorage" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// src/cache/LocalStorage.ts:366:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
1545
1543
// src/cache/LocalStorage.ts:429:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
1546
1544
// src/cache/LocalStorage.ts:460:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
1547
-
// src/config/Configuration.ts:213:5 - (ae-incompatible-release-tags) The symbol "experimental" is marked as @public, but its signature references "BrowserExperimentalOptions" which is marked as @internal
1548
-
// src/config/Configuration.ts:222:5 - (ae-forgotten-export) The symbol "InternalAuthOptions" needs to be exported by the entry point index.d.ts
1545
+
// src/config/Configuration.ts:217:5 - (ae-incompatible-release-tags) The symbol "experimental" is marked as @public, but its signature references "BrowserExperimentalOptions" which is marked as @internal
1546
+
// src/config/Configuration.ts:226:5 - (ae-forgotten-export) The symbol "InternalAuthOptions" needs to be exported by the entry point index.d.ts
1549
1547
// src/event/EventHandler.ts:116:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
1550
1548
// src/event/EventHandler.ts:143:8 - (tsdoc-param-tag-missing-hyphen) The @param block should be followed by a parameter name and then a hyphen
1551
1549
// src/index.ts:8:12 - (tsdoc-characters-after-block-tag) The token "@azure" looks like a TSDoc tag but contains an invalid character "/"; if it is not a tag, use a backslash to escape the "@"
Copy file name to clipboardExpand all lines: lib/msal-browser/docs/device-bound-tokens.md
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
-
# Acquiring Device Bound Tokens using Web Account Manager (WAM) on Windows
1
+
# Acquiring Device Bound Tokens using platform brokers
2
2
3
-
MSAL.js supports acquiring tokens from the Web Account Manager (WAM) on Windows. These tokens are bound to the device they were acquired on and are not cached in the browser's localStorage or sessionStorage.
3
+
MSAL.js supports acquiring tokens from the platform broker, say Web Account Manager (WAM) on Windows and Mac Broker on Mac. These tokens are bound to the device they were acquired on and are not cached in the browser's localStorage or sessionStorage.
4
4
5
5
## Supported Environment
6
6
7
7
This feature is currently only supported in the following environment:
8
8
9
-
- A machine running a Windows build that supports the feature (more to come on this)
9
+
- A machine running a Windows build that supports the feature (more to come on this) or a Company Portal managed Mac with a specific Mac OS version (more to come on this).
10
10
- Chrome and Edge browsers or Teams
11
11
-[Windows Accounts extension](https://chrome.google.com/webstore/detail/windows-accounts/ppnbnpeolgkicgegkbkbjmhlideopiji) (version 1.0.5 or higher) is installed if using Chrome or Edge
12
12
- App must be hosted on `https`
@@ -45,10 +45,37 @@ pca.acquireTokenSilent();
45
45
46
46
No other changes are needed to support this new feature. Any user accessing your app from a supported environment will now be able to acquire device bound tokens. Users in non-supported environments will continue to acquire tokens through the traditional web-based flows.
47
47
48
-
## Differences when using WAM to acquire tokens
48
+
## Differences when using Platform Broker to acquire tokens
49
49
50
-
There are a few things that may behave a little differently when acquiring tokens through WAM.
50
+
There are a few things that may behave a little differently when acquiring tokens through the platform broker.
51
51
52
-
- All cache related configuration applies only to MSAL's local cache. The native broker controls its own, more secure, cache which is used instead of browser storage and it does not support configuration of its cache behavior. This means you may receive a cached token regardless of the value of request parameters such as: `forceRefresh`, `cacheLookupPolicy` or `storeInCache`. In addition, tokens received from the native broker are _not_ stored in local or session storage regardless of what you have configured on PublicClientApplication.
53
-
- If WAM needs to prompt the user for interaction a system prompt will be opened. This prompt looks a bit different from the browser popup windows you may be used to.
54
-
- Switching your account in the WAM prompt is not supported and MSAL.js will throw an error (Error Code: user_switch) if this happens. It is your app's responsibility to catch this error and handle it in a way that makes sense for your scenarios (e.g. Show an error page, retry with the new account, retry with the original account, etc.)
52
+
- All cache related configuration applies only to MSAL's local cache. The platform broker controls its own, more secure, cache which is used instead of browser storage and it does not support configuration of its cache behavior. This means you may receive a cached token regardless of the value of request parameters such as: `forceRefresh`, `cacheLookupPolicy` or `storeInCache`. In addition, tokens received from the platform broker are _not_ stored in local or session storage regardless of what you have configured on PublicClientApplication.
53
+
- If the platform broker needs to prompt the user for interaction a system prompt will be opened. This prompt looks a bit different from the browser popup windows you may be used to.
54
+
- Switching your account in the platform broker prompt is not supported and MSAL.js will throw an error (Error Code: user_switch) if this happens. It is your app's responsibility to catch this error and handle it in a way that makes sense for your scenarios (e.g. Show an error page, retry with the new account, retry with the original account, etc.)
55
+
56
+
## Acquiring Device Bound Tokens using DOM API
57
+
58
+
MSAL.js also supports acquiring tokens from the platform broker using DOM APIs in Edge. Instead of using a browser extension to communicate with the platform broker, MSAL.js can directly call a DOM API in the Edge browser, which in turn invokes the platform broker to acquire tokens.
59
+
60
+
- This feature is currently only supported in the Edge browser and all other OS requirements mentioned above still apply. (more details to come).
61
+
- This feature is currently only in private-preview and requires special enablement.
62
+
63
+
To enable this feature, set the `allowPlatformBrokerWithDOM` flag to true in the `experimental` section of your configuration object like so:
64
+
65
+
```javascript
66
+
constmsalConfig= {
67
+
auth: {
68
+
clientId:"insert-clientId",
69
+
},
70
+
system: {
71
+
allowPlatformBroker:true,
72
+
},
73
+
experimental: {
74
+
allowPlatformBrokerWithDOM:true,
75
+
},
76
+
};
77
+
```
78
+
79
+
Note: The `allowPlatformBroker` flag must also be set to true in order to use this feature. There will be a configuration error - `invalid_platform_broker_configuration` if `allowPlatformBrokerWithDOM` is set to true while `allowPlatformBroker` is false.
80
+
81
+
Eventually, in a future major version, this flag will be merged with `allowPlatformBroker` and MSAL.js will make the decision to use either the browser extension or DOM APIs based on the environment automatically. The behavior and availability of `experimental` flags is subject to change at any time, without following semver rules.
0 commit comments