Skip to content

Commit 05730b0

Browse files
jo-arroyotnorling
andauthored
Angular sample updates for MSAL Angular v4 and Angular 19 support (#7514)
This PR: - Updates MSAL Angular docs with MSAL Angular v4 information and Angular 19 support - Adds MSAL Angular v4 migration doc - Updates the angular18-standalone-sample to use Angular 19 and renames it angular-standalone-sample. This sample is moved to msal-angular-samples folder. - Moves the following samples to the msal-angular-samples folder and ensure they work with MSAL Angular v4: - angular-b2c-sample - angular16-sample (renamed to angular-modules-sample) - Removes the following v3 samples from the msal-angular-samples folder: (they continue to live on in the v3-lts branch) - angular-standalone-sample (basic sample that used Angular 16) - angular-15-sample - angular-17-standalone-sample - Updates pipeline with renamed samples - Updates roadmap with removal of Angular 19 support --------- Co-authored-by: Thomas Norling <thomas.norling@microsoft.com>
1 parent 5106a23 commit 05730b0

File tree

233 files changed

+6919
-26935
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+6919
-26935
lines changed

.pipelines/3p-e2e.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,10 @@ extends:
127127
stage: "CI"
128128
sourceRepo: ${{ variables.sourceRepo }}
129129
sourceBranch: ${{ variables.sourceBranch }}
130-
workspace: "samples/msal-angular-v3-samples"
130+
workspace: "samples/msal-angular-samples"
131131
samples:
132-
- "angular15-sample-app"
133-
- "angular16-sample-app"
134-
- "angular-b2c-sample-app"
132+
- "angular-b2c-sample"
133+
- "angular-modules-sample"
135134
- "angular-standalone-sample"
136-
- "angular17-standalone-sample"
137135
debug: ${{ parameters.debug }}
138136
npmInstallTimeout: ${{ parameters.npmInstallTimeout }}

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# MSAL Angular
44
/lib/msal-angular/ @jo-arroyo @tnorling @peterzenz
5-
/samples/msal-angular-v3-samples/ @jo-arroyo @tnorling @peterzenz
5+
/samples/msal-angular-samples/ @jo-arroyo @tnorling @peterzenz
66

77
# MSAL Browser
88
/lib/msal-browser/ @sameerag @tnorling @hectormmg @jo-arroyo @peterzenz @konstantin-msft @lalimasharda @shylasummers

lib/msal-angular/FAQ.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,21 @@ Please see [here](https://github.com/AzureAD/microsoft-authentication-library-fo
4444

4545
### What versions of Angular are supported?
4646

47-
MSAL Angular v3 currently supports Angular 15, 16, 17 and 18.
47+
MSAL Angular v4 currently supports Angular 15, 16, 17, 18, and 19.
48+
49+
MSAL Angular v3 supports Angular 15, 16, 17 and 18.
4850

4951
MSAL Angular v2 supports Angular 9, 10, 11, 12, 13 and 14.
5052

5153
### Does `@azure/msal-angular` support Server Side Rendering?
5254

5355
Yes, server side rendering is supported through Angular universal. See our doc [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/angular-universal.md) for more information.
5456

55-
**Note:** MSAL Angular currently does not officially support Angular 17 and 18's server-side and prerendering capabilities. Using SSR with MSAL Angular may break your app.
57+
**Note:** MSAL Angular currently does not officially support server-side and prerendering capabilities. Using SSR with MSAL Angular may break your app.
5658

5759
### Does `@azure/msal-angular` support standalone components?
5860

59-
MSAL Angular v3 supports standalone components. Please see our [redirect documentation](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/redirects.md) for more information on using standalone components with redirects and our [standalone sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular-standalone-sample) and [Angular 17 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular17-standalone-sample)for usage details.
61+
MSAL Angular supports standalone components. Please see our [redirect documentation](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/redirects.md) for more information on using standalone components with redirects and our [standalone sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-standalone-sample) for usage details.
6062

6163
### Can `@azure/msal-angular` be used with Internet Explorer?
6264

@@ -74,8 +76,6 @@ Yes, `@azure/msal-angular` can be used as a custom authentication provider for t
7476

7577
Please see our [v2 to v3 upgrade guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/v2-v3-upgrade-guide.md) for information on the differences between `@azure/msal-angular` v3 and v2, as well as changes to watch out for when upgrading.
7678

77-
Note that MSAL Angular v3 is currently in alpha and additional features and bug fixes will be added.
78-
7979
### What is the difference between `@azure/msal-angular` v2 and v1?
8080

8181
Please see our [v1 to v2 upgrade guide](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/v1-v2-upgrade-guide.md) for information on the differences between `@azure/msal-angular` v1 and v2, as well as changes to watch out for when upgrading.
@@ -87,7 +87,7 @@ Please see our [v1 to v2 upgrade guide](https://github.com/AzureAD/microsoft-aut
8787
* [MsalInterceptor doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/msal-interceptor.md) for details on configuration and use
8888
* [Initialization doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/initialization.md#get-tokens-for-web-api-calls) for basic set up
8989
* [Configuration doc](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-angular/docs/configuration.md) for different ways to configure MSAL
90-
* [Samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular15-sample-app/src/app/app.module.ts#L52) for examples of usage
90+
* [Samples](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples) for examples of usage
9191

9292
Please note that the `MsalInterceptor` is optional. You may wish to explicitly acquire tokens using the acquireToken APIs instead. The `MsalInterceptor` is provided for your convenience and may not fit all use cases. We encourage you to write your own interceptor if you have specific needs that are not addressed by the `MsalInterceptor`.
9393

@@ -118,7 +118,7 @@ For those using the `PathLocationStrategy`, we recommend:
118118
- Making sure the `MsalRedirectComponent` is bootstrapped
119119
- Optionally: adding `MsalGuard` to all your routes if you want all your routes protected
120120

121-
Our [Angular 15 sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular15-sample-app) demonstrates use of the `PathLocationStrategy`.
121+
Our [Angular Modules Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-modules-sample) demonstrates use of the `PathLocationStrategy`.
122122

123123
#### HashLocationStrategy
124124

@@ -134,7 +134,7 @@ Our older [Angular 11 sample](https://github.com/AzureAD/microsoft-authenticatio
134134

135135
One of the common reasons your app may be looping while logging in with redirects is due to improper usage of the `loginRedirect()` API. We recommend that you do not call `loginRedirect()` in the `ngOnInit` in the `app.component.ts`, as this will attempt to log in with every page load, often before any redirect has finished processing.
136136

137-
Redirects **must** be handled either with the `MsalRedirectComponent` or with calling `handleRedirectObservable()`. See our docs on redirects [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/redirects.md) for more information. Additionally, any interaction or account validation should be done after subscribing to the `inProgress$` observable of `MsalBroadcastService` and filtering for `InteractionStatus.None`. Please see our [sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular15-sample-app/src/app/app.component.ts#L43) for an example.
137+
Redirects **must** be handled either with the `MsalRedirectComponent` or with calling `handleRedirectObservable()`. See our docs on redirects [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/redirects.md) for more information. Additionally, any interaction or account validation should be done after subscribing to the `inProgress$` observable of `MsalBroadcastService` and filtering for `InteractionStatus.None`. Please see our [sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-modules-sample/src/app/app.component.ts#L43) for an example.
138138

139139
## How do I implement self-service sign-up?
140140
MSAL Angular supports self-service sign-up in the auth code flow. Please see our docs [here](https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_browser.html#popuprequest) for supported prompt values in the request and their expected outcomes, and [here](http://aka.ms/s3u) for an overview of self-service sign-up and configuration changes that need to be made to your Azure tenant. Please note that that self-service sign-up is not available in B2C and test environments.
@@ -149,7 +149,7 @@ Please see our [MsalGuard doc](https://github.com/AzureAD/microsoft-authenticati
149149

150150
The `@azure/msal-browser` instance used by `@azure/msal-angular` exposes multiple methods for getting account information. We recommend using `getAllAccounts()` to get all accounts, and `getAccountByHomeId()` and `getAccountByLocalId()` to get specific accounts. Note that while `getAccountByUsername()` is available, it should be a secondary choice, as it may be less reliable and is for convenience only. See the [`@azure/msal-browser` docs](https://azuread.github.io/microsoft-authentication-library-for-js/ref/classes/_azure_msal_browser.publicclientapplication.html) for more details on account methods.
151151

152-
We recommend subscribing to the `inProgress$` observable of `MsalBroadcastService` and filtering for `InteractionStatus.None` before retrieving account information. This ensures that all interactions have completed before getting account information. See [our sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular15-sample-app/src/app/app.component.ts#L45) for an example of this use.
152+
We recommend subscribing to the `inProgress$` observable of `MsalBroadcastService` and filtering for `InteractionStatus.None` before retrieving account information. This ensures that all interactions have completed before getting account information. See [our sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-modules-sample/src/app/app.component.ts#L45) for an example of this use.
153153

154154
### How do I get and set active accounts?
155155

@@ -159,12 +159,12 @@ We recommend subscribing to the `inProgress$` observable of `MsalBroadcastServic
159159

160160
We recommend setting the active account:
161161

162-
- After any action that may change the account, especially if your app uses multiple accounts. See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular15-sample-app/src/app/home/home.component.ts#L24) for an example of setting the account after a successful login.
163-
- On initial page load. Wait until all interactions are complete (by subscribing to the `inProgress$` observable of `MsalBroadcastService` and filtering for `InteractionStatus.None`), check if there is an active account, and if there is none, set the active account. This could be the first account retrieved by `getAllAccounts()`, or other account selection logic required by your app. See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular15-sample-app/src/app/app.component.ts#L43) for an example of checking and setting the active account on page load.
162+
- After any action that may change the account, especially if your app uses multiple accounts. See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-modules-sample/src/app/home/home.component.ts#L24) for an example of setting the account after a successful login.
163+
- On initial page load. Wait until all interactions are complete (by subscribing to the `inProgress$` observable of `MsalBroadcastService` and filtering for `InteractionStatus.None`), check if there is an active account, and if there is none, set the active account. This could be the first account retrieved by `getAllAccounts()`, or other account selection logic required by your app. See [here](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-modules-sample/src/app/app.component.ts#L43) for an example of checking and setting the active account on page load.
164164

165165
**Note:** Prior to `@azure/msal-browser@2.16.0` active account did not persist across page loads. If you are using `@azure/msal-browser@2.15.0` or earlier we recommend that you set the active account for each page load. In version 2.16.0 and above the active account will be cached in the cache location specified in your MSAL config and retrieved each time `getActiveAccount` is called.
166166

167-
Our [Angular 15](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-v3-samples/angular15-sample-app) sample demonstrates basic usage. Your app may require more complicated logic to choose accounts.
167+
Our [Angular Modules Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/samples/msal-angular-samples/angular-modules-sample) demonstrates basic usage. Your app may require more complicated logic to choose accounts.
168168

169169
## Errors
170170

lib/msal-angular/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
![npm](https://img.shields.io/npm/dw/@azure/msal-angular)
55
[![codecov](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js/branch/dev/graph/badge.svg?flag=msal-angular)](https://codecov.io/gh/AzureAD/microsoft-authentication-library-for-js)
66

7-
| <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-angular-auth-code" target="blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_angular.html" target="_blank">Library Reference</a> | [Support](README.md#community-help-and-support) | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples" target="blank">Samples</a> |
7+
| <a href="https://docs.microsoft.com/azure/active-directory/develop/tutorial-v2-angular-auth-code" target="blank">Getting Started</a> | <a href="https://aka.ms/aaddevv2" target="_blank">AAD Docs</a> | <a href="https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_angular.html" target="_blank">Library Reference</a> | [Support](README.md#community-help-and-support) | <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples" target="blank">Samples</a> |
88
| ------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
99

1010
1. [About](#about)
@@ -34,6 +34,7 @@ The current `@azure/msal-angular` library improves upon the previous version and
3434

3535
## Guides
3636

37+
- [Upgrade Guide (v3-v4)](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v3-v4-upgrade-guide.md)
3738
- [Upgrade Guide (v2-v3)](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v2-v3-upgrade-guide.md)
3839
- [Upgrade Guide (v1-v2)](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v1-v2-upgrade-guide.md)
3940
- [Upgrade Guide (v0-v1)](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-angular/docs/v0-v1-upgrade-guide.md)
@@ -45,7 +46,8 @@ At a minimum, `@azure/msal-angular` will follow the [support schedule of the mai
4546

4647
| MSAL Angular version | MSAL support status | Supported Angular versions |
4748
| -------------------- | ------------------- | -------------------------- |
48-
| MSAL Angular v3 | Active development | 15, 16, 17, 18 |
49+
| MSAL Angular v4 | Active development | 15, 16, 17, 18, 19 |
50+
| MSAL Angular v3 | In maintenance | 15, 16, 17, 18 |
4951
| MSAL Angular v2 | In maintenance | 9, 10, 11, 12, 13, 14 |
5052
| MSAL Angular v1 | In maintenance | 6, 7, 8, 9 |
5153
| MSAL Angular v0 | Out of support | 4, 5 |
@@ -89,14 +91,20 @@ Documentation specifically for MSAL Angular v1 can be found [here](https://githu
8991

9092
## Samples
9193

94+
### Current MSAL Angular Samples
95+
96+
- [Angular B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-b2c-sample)
97+
- [Angular Modules Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-modules-sample)
98+
- [Angular Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-samples/angular-standalone-sample)
99+
92100
### MSAL Angular v3 Samples
93101

94-
- [Angular v15](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular15-sample-app)
95-
- [Angular v16](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular16-sample-app)
96-
- [Angular v16 B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular-b2c-sample-app)
97-
- [Angular Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular-standalone-sample)
98-
- [Angular v17 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular17-standalone-sample)
99-
- [Angular v18 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/samples/msal-angular-v3-samples/angular18-standalone-sample)
102+
- [Angular v15](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular15-sample-app)
103+
- [Angular v16](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular16-sample-app)
104+
- [Angular v16 B2C Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular-b2c-sample-app)
105+
- [Angular Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular-standalone-sample)
106+
- [Angular v17 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular17-standalone-sample)
107+
- [Angular v18 Standalone Sample](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/v3-lts/samples/msal-angular-v3-samples/angular18-standalone-sample)
100108

101109
### MSAL Angular v2 Samples
102110

0 commit comments

Comments
 (0)