Single-page application: Code configuration
Learn how to configure the code for your single-page application (SPA).
Microsoft libraries supporting single-page apps
The following Microsoft libraries support single-page apps:
Language / framework | Project on GitHub |
Package | Getting started |
Sign in users | Access web APIs | Generally available (GA) or Public preview1 |
---|---|---|---|---|---|---|
Angular | MSAL Angular v22 | msal-angular | Quickstart | ![]() |
![]() |
GA |
Angular | MSAL Angular3 | msal-angular | — | ![]() |
![]() |
GA |
AngularJS | MSAL AngularJS3 | msal-angularjs | — | ![]() |
![]() |
Public preview |
JavaScript | MSAL.js v22 | msal-browser | Tutorial | ![]() |
![]() |
GA |
JavaScript | MSAL.js 1.03 | msal-core | — | ![]() |
![]() |
GA |
React | MSAL React2 | msal-react | Quickstart | ![]() |
![]() |
GA |
1 Universal License Terms for Online Services apply to libraries in Public preview.
2 Auth code flow with PKCE only (Recommended).
3 Implicit grant flow only (Not recommended).
Application code configuration
In an MSAL library, the application registration information is passed as configuration during the library initialization.
import * as Msal from "@azure/msal-browser"; // if using CDN, 'Msal' will be available in global scope
// Configuration object constructed.
const config = {
auth: {
clientId: 'your_client_id'
}
};
// create PublicClientApplication instance
const publicClientApplication = new Msal.PublicClientApplication(config);
For more information on the configurable options, see Initializing application with MSAL.js.
Next steps
Move on to the next article in this scenario, Sign-in and sign-out.
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για