File tree Expand file tree Collapse file tree
1-Authentication/0-sign-in-vanillajs/App/public
2-Authorization/0-call-api-vanillajs/SPA/public Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Create the main myMSALObj instance
22// configuration parameters are located at authConfig.js
3- const myMSALObj = new msal . PublicClientApplication ( msalConfig ) ;
4-
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- } ) ;
3+ let myMSALObj ;
4+
5+ msal . PublicClientApplication . createPublicClientApplication ( msalConfig )
6+ . then ( ( obj ) => {
7+ myMSALObj = obj ;
8+ } )
9+ . catch ( ( error ) => {
10+ console . error ( "Error creating MSAL PublicClientApplication:" , error ) ;
1611 } ) ;
1712
1813let username = "" ;
Original file line number Diff line number Diff line change 11// Create the main myMSALObj instance
22// configuration parameters are located at authConfig.js
3- const myMSALObj = new msal . PublicClientApplication ( msalConfig ) ;
4-
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 )
3+ msal . PublicClientApplication . createPublicClientApplication ( msalConfig )
4+ . then ( ( obj ) => {
5+ myMSALObj = obj ;
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+ } )
1317 . catch ( ( error ) => {
14- console . error ( error ) ;
18+ console . error ( "Error creating MSAL PublicClientApplication:" , error ) ;
1519 } ) ;
16- } ) ;
1720
1821let username = "" ;
1922
Original file line number Diff line number Diff line change 11// Create the main myMSALObj instance
22// configuration parameters are located at authConfig.js
3- const myMSALObj = new msal . PublicClientApplication ( msalConfig ) ;
3+ let myMSALObj ;
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- } ) ;
5+ msal . PublicClientApplication . createPublicClientApplication ( msalConfig )
6+ . then ( ( obj ) => {
7+ myMSALObj = obj ;
8+ } )
9+ . catch ( ( error ) => {
10+ console . error ( "Error creating MSAL PublicClientApplication:" , error ) ;
1611 } ) ;
1712
1813let username = '' ;
Original file line number Diff line number Diff line change 11// Create the main myMSALObj instance
22// configuration parameters are located at authConfig.js
3- const myMSALObj = new msal . PublicClientApplication ( msalConfig ) ;
4-
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 ( )
3+ msal . PublicClientApplication . createPublicClientApplication ( msalConfig )
4+ . then ( ( obj ) => {
5+ myMSALObj = obj ;
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 ( )
1212 . then ( handleResponse )
1313 . catch ( ( error ) => {
1414 console . error ( error ) ;
1515 } ) ;
16+ } )
17+ . catch ( ( error ) => {
18+ console . error ( "Error creating MSAL PublicClientApplication:" , error ) ;
1619 } ) ;
1720
1821let username = '' ;
You can’t perform that action at this time.
0 commit comments