File tree Expand file tree Collapse file tree
2-Authorization/0-call-api-vanillajs/SPA Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22// configuration parameters are located at authConfig.js
33const myMSALObj = new msal . PublicClientApplication ( msalConfig ) ;
44
5+ myMSALObj . initialize ( ) . then ( ( ) => {
6+ /**
7+ * A promise handler needs to be registered for handling the
8+ * response returned from redirect flow. For more information, visit:
9+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md#redirect-apis
10+ */
11+ myMSALObj . handleRedirectPromise ( )
12+ . then ( handleResponse )
13+ . catch ( ( error ) => {
14+ console . error ( error ) ;
15+ } ) ;
16+ } ) ;
17+
518let username = '' ;
619
720function selectAccount ( ) {
Original file line number Diff line number Diff line change 22// configuration parameters are located at authConfig.js
33const myMSALObj = new msal . PublicClientApplication ( msalConfig ) ;
44
5+ myMSALObj . initialize ( ) . then ( ( ) => {
6+ /**
7+ * A promise handler needs to be registered for handling the
8+ * response returned from redirect flow. For more information, visit:
9+ * https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/initialization.md#redirect-apis
10+ */
11+ myMSALObj . handleRedirectPromise ( )
12+ . then ( handleResponse )
13+ . catch ( ( error ) => {
14+ console . error ( error ) ;
15+ } ) ;
16+ } ) ;
17+
518let username = '' ;
619
720/**
Original file line number Diff line number Diff line change 77 < title > Microsoft identity platform</ title >
88 < link rel ="SHORTCUT ICON " href ="./favicon.svg " type ="image/x-icon ">
99 < link rel ="stylesheet " href ="./styles.css ">
10- <!-- msal.min.js can be used in the place of msal.js; included msal.js to make debug easy -->
11- < script id ="load-msal " src ="https://alcdn.msauth.net/browser/2.31.0/js/msal-browser.js "
12- integrity ="sha384-BO4qQ2RTxj2akCJc7t6IdU9aRg6do4LGIkVVa01Hm33jxM+v2G+4q+vZjmOCywYq "
13- crossorigin ="anonymous "> </ script >
10+ <!-- msal.min.js can be used in the place of msal-browser.js -->
11+ < script src ="/msal-browser.min.js "> </ script >
1412 <!-- adding Bootstrap 5 for UI components -->
1513 < link href ="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css " rel ="stylesheet "
1614 integrity ="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi " crossorigin ="anonymous ">
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ app.use(morgan('dev'));
1313// Setup app folders.
1414app . use ( express . static ( 'public' ) ) ;
1515
16+ // serve msal-browser module
17+ app . use ( express . static ( path . join ( __dirname , "node_modules/@azure/msal-browser/lib" ) ) ) ;
18+
1619// set up a route for redirect.html
1720app . get ( '/redirect' , ( req , res ) => {
1821 res . sendFile ( path . join ( __dirname + '/public/redirect.html' ) ) ;
You can’t perform that action at this time.
0 commit comments