Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e41e39a
Add support for authorize call using method POST (#7920)
hectormmg Jul 22, 2025
6d6d36c
Change files
hectormmg Aug 13, 2025
e952207
Merge branch 'msal-v5' into post-authorize
hectormmg Aug 14, 2025
e601e39
Merge branch 'msal-v5' into post-authorize
hectormmg Sep 9, 2025
a5f9447
Merge branch 'post-authorize' of https://github.com/AzureAD/microsoft…
hectormmg Sep 9, 2025
79166df
Add migration guide update for extra parameters
hectormmg Sep 9, 2025
c1f7413
Merge branch 'msal-v5' into post-authorize
hectormmg Sep 23, 2025
c526bcf
Replace outdated extra param options in base auth request and other r…
hectormmg Sep 23, 2025
2ed9562
Update v4 migration doc
hectormmg Oct 21, 2025
6666e63
Replace tokenBodyParameters usage with extraParams
hectormmg Oct 21, 2025
3baebc5
Fix merge conflicts
hectormmg Oct 21, 2025
720cab3
Update v5 migration
hectormmg Oct 21, 2025
8fa8d48
Update common tests
hectormmg Oct 21, 2025
e3e324b
Update tests to account for changes in extra param configuration
hectormmg Oct 21, 2025
7456d17
Change files
hectormmg Oct 21, 2025
8f102ef
Update changefile
hectormmg Oct 21, 2025
fb73bf6
Update node tests and api extractor review files
hectormmg Oct 21, 2025
2eecd5f
Fix lint and format issues
hectormmg Oct 21, 2025
bbb7634
Fix format
hectormmg Oct 22, 2025
85d7d67
Merge branch 'msal-v5' into post-authorize
hectormmg Oct 26, 2025
26dacec
Merge branch 'msal-v5' into post-authorize
hectormmg Oct 28, 2025
a8d0f83
Update extraParameters property name
hectormmg Oct 29, 2025
a4070f9
Update lib/msal-browser/src/request/RequestHelpers.ts
hectormmg Oct 29, 2025
e81ce3e
Refactor addExtraParameters APIs in request parameter builder
hectormmg Oct 29, 2025
008ff07
Update v4-migration with better examples and extra notes
hectormmg Oct 30, 2025
dfd999e
Fix format
hectormmg Oct 30, 2025
084b558
Update platform auth tests
hectormmg Oct 30, 2025
8a15a85
Update docs/errors.md
hectormmg Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Add support for authorize call using method POST #7997",
"packageName": "@azure/msal-browser",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Add support for authorize call using method POST#7997",
"packageName": "@azure/msal-common",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Update tests to account for changes in extra param configuration",
"packageName": "@azure/msal-node",
"email": "[email protected]",
"dependentChangeType": "patch"
}
3 changes: 3 additions & 0 deletions docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ This error occurs when MSAL.js surpasses the allotted storage limit when attempt

- 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.

### `invalid_request_method_for_EAR`
- The EAR protocol cannot be used with HTTP method `GET`. The `httpMethod` parameter in all requests using `protocolMode: ProtocolMode.EAR` must be either unset or `"POST"`/`HttpMethod.POST`.

## Interaction required errors

### `no_tokens_found`
Expand Down
4 changes: 2 additions & 2 deletions lib/msal-browser/apiReview/msal-browser.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ const emptyWindowError = "empty_window_error";
// Warning: (ae-missing-release-tag) "EndSessionPopupRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type EndSessionPopupRequest = Partial<Omit<CommonEndSessionRequest, "tokenQueryParameters">> & {
export type EndSessionPopupRequest = Partial<CommonEndSessionRequest> & {
authority?: string;
mainWindowRedirectUri?: string;
popupWindowAttributes?: PopupWindowAttributes;
Expand All @@ -561,7 +561,7 @@ export type EndSessionPopupRequest = Partial<Omit<CommonEndSessionRequest, "toke
// Warning: (ae-missing-release-tag) "EndSessionRequest" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type EndSessionRequest = Partial<Omit<CommonEndSessionRequest, "tokenQueryParameters">> & {
export type EndSessionRequest = Partial<CommonEndSessionRequest> & {
authority?: string;
};

Expand Down
134 changes: 113 additions & 21 deletions lib/msal-browser/docs/v4-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,31 @@ if (result) {

// AFTER
const shr = new SignedHttpRequest(shrParameters, shrOptions);
await shr.removeKeys(thumbprint).then(() => {
// do something on success
}).catch(e => {
// do something on failure
console.log(e);
});
await shr
.removeKeys(thumbprint)
.then(() => {
// do something on success
})
.catch((e) => {
// do something on failure
console.log(e);
});
```

### TokenCache and loadExternalTokens

MSAL JS API for [loadExternalTokens](../testing.md#the-loadexternaltokens-api) is modified. The changes include:
* `TokenCache` object and `getTokenCache()` have been removed
* The `loadExternalTokens()` API is now a separate export and requires `Configuration` as a parameter

- `TokenCache` object and `getTokenCache()` have been removed
- The `loadExternalTokens()` API is now a separate export and requires `Configuration` as a parameter

```js
// BEFORE

const pca = new PublicClientApplication(config);
await pca.getTokenCache().loadExternalTokens(
silentRequest,
serverResponse,
loadTokenOptions
);
await pca
.getTokenCache()
.loadExternalTokens(silentRequest, serverResponse, loadTokenOptions);

//AFTER

Expand All @@ -65,19 +67,19 @@ Previously, `PublicClientApplication.handleRedirectPromise` took in an optional
```javascript
// BEFORE
const hash = window.location.hash; // Arbitrary example value
pca.handleRedirectPromise(hash)

pca.handleRedirectPromise(hash);

// AFTER
pca.handleRedirectPromise({
hash: window.location.hash, // Option nested inside a `HandleRedirectPromiseOptions` object
navigateToLoginRequestUrl: true // Additional option
})
navigateToLoginRequestUrl: true, // Additional option
});
```

### Removal of some functions in `PublicClientApplication`
### Removal of some functions in `PublicClientApplication`

The following functions in `PublicClientApplication` have been removed:

1. `enableAccountStorageEvents()` and `disableAccountStorageEvents()`: account storage events are now always enabled. These function calls are no longer necessary.
1. `getAccountByHomeId()`, `getAccountByLocalId()`, and `getAccountByUsername()`: use `getAccount()` instead.

Expand All @@ -88,10 +90,15 @@ The following functions in `PublicClientApplication` have been removed:
const account3 = accountManager.getAccountByUsername(yourUsername);

// AFTER
const account1 = accountManager.getAccount({ homeAccountId: yourHomeAccountId });
const account2 = accountManager.getAccount({ localAccountId: yourLocalAccountId });
const account1 = accountManager.getAccount({
homeAccountId: yourHomeAccountId,
});
const account2 = accountManager.getAccount({
localAccountId: yourLocalAccountId,
});
const account3 = accountManager.getAccount({ username: yourUsername });
```

1. `logout()`: use `logoutRedirect()` or `logoutPopup()` instead.

### Removal of `startPerformanceMeasurement()`
Expand All @@ -108,10 +115,12 @@ The following functions in `PublicClientApplication` have been removed:
1. The `navigateTologinRequestUrl` parameter has been removed from BrowserAuthOptions in Configuration and can instead now be provided inside an options object as a parameter on the call to `handleRedirectPromise`:

```typescript
pca.handleRedirectPromise({ navigateToLoginRequestUrl: false })
pca.handleRedirectPromise({ navigateToLoginRequestUrl: false });
```

1. The `encodeExtraQueryParams` parameter has been removed. All extra query params will be encoded.
1. The `supportsNestedAppAuth` parameter has been removed. Use `createNestablePublicClientApplication()` instead.

```typescript
// BEFORE
const pca = new PublicClientApplication({
Expand All @@ -130,6 +139,7 @@ The following functions in `PublicClientApplication` have been removed:
}
});
```

1. The `OIDCOptions` parameter now takes in a `ResponseMode` instead of a `ServerResponseType`. Please use `ResponseMode.QUERY` in place of `ServerResponseType.QUERY` and `ResponseMode.FRAGMENT` instead of `ServerResponseType.FRAGMENT`.

### CacheOptions changes
Expand Down Expand Up @@ -161,6 +171,88 @@ See the [Configuration doc](./configuration.md#system-config-options) for more d

The `onRedirectNavigate` parameter will *only be supported* from `Configuration` object going forward and is removed from `RedirectRequest` and `EndSessionRequest` objects. Please ensure to set it in msal config if you need to use it.

### Consolidation of extra request parameters

The following request parameters have been removed:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. I would move this to PS as a note and highlight the PS with a removal notice as needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, not sure I understand. I think the above comment you're referring to did not get submitted?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant can we mention the new support first and then follow up with removed params. Better for readability.


- `authorizePostBodyParams`
- `tokenBodyParameters`
- `tokenQueryParameters`

In order to simplify extra request parameters, generic extra parameters should go in the new `extraParameters` request option. When `extraParameters` are set in a request, they will be sent on all token service calls in either the URL query string or the request body, depending on the `httpMethod` configured (default is `GET`) in the request. **To submit extra parameters that MUST go in the URL query string, `extraQueryParameters` is still available.**

> Note: If you're unsure whether the extra parameter should go in the `extraQueryStringParameters` or the `extraParameters`, it should most likely go in `extraParameters`.


#### v4 (previous) request example:

```javascript
// Example of a GET request with extra parameters
const authRequest = {
scopes: ["SAMPLE_SCOPE"],
extraQueryParamters: {
"dc": "DC_VALUE" // This was sent on the query string on GET /authorize
},
tokenBodyParameters: {
"extra_parameters_assertion": "ASSERTION_VALUE" // This was sent on the POST body to /token
},
tokenQueryParamters: {
"slice": "SLICE_VALUE" // This was sent on the query string on POST /token
}
}

// Example of a POST request with extra parameters
const authRequest = {
scopes: ["SAMPLE_SCOPE"],
httpMethod: "POST", // default is "GET" -> Determines method for "/authorize" call. Calls to "/token" are always POST
extraQueryParamters: {
"dc": "DC_VALUE" // This was sent on the query string on POST /authorize
},
authorizePostBodyParameters: {
"extra_parameters_assertion": "ASSERTION_VALUE", // This was sent on the body on POST /authorize
}
tokenBodyParameters: {
"extra_parameters_assertion": "ASSERTION_VALUE" // This was sent on the POST body to /token
},
tokenQueryParamters: {
"slice": "SLICE_VALUE" // This was sent on the query string on POST /token
}
}
```

#### v5 Request Example

```javascript
// Example of a GET request with extra parameters
const authRequest = {
scopes: ["SAMPLE_SCOPE"],
extraQueryParamters: {
// Will be sent in query string to /authorize and /token
"dc": "DC_VALUE",
"slice": "SLICE_VALUE"
},
extraParameters: {
"extra_parameters_assertion": "ASSERTION_VALUE", // Will be sent in query string to /authorize and in body to /token
},
};

// Example of a POST request with extra parameters
const authRequest = {
scopes: ["SAMPLE_SCOPE"],
httpMethod: "POST", // default is "GET" -> Determines method for "/authorize" call. Calls to "/token" are always POST
extraQueryParamters: {
// Will be sent in query string to /authorize and /token
"dc": "DC_VALUE",
"slice": "SLICE_VALUE"
},
extraParameters: {
extra_parameter_assertion: "assertion_value", // Will be sent in post body to /authorize and /token
},
};
```

> Note: In cases where MSAL determines `extraParameters` must be encoded into the URL string, `extraParameters` will be merged with `extraQueryParams` in a way that will cause same-named parameters to be overwritten. In these cases, the value for the parameter in `extraParameters` will take precedence over the value in the `extraQueryParams`.

## Behavioral Breaking Changes

### Event types and InteractionStatus changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,7 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
tokenType: request.authenticationScheme,
windowTitleSubstring: document.title,
extraParameters: {
...request.extraQueryParameters,
...request.tokenQueryParameters,
...request.extraParameters,
},
extendedExpiryToken: false, // Make this configurable?
keyId: request.popKid,
Expand Down
Loading