@@ -377,6 +377,8 @@ export class UserAgentApplication {
377
377
* @returns {Promise.<AuthResponse> } - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
378
378
*/
379
379
acquireTokenPopup ( userRequest : AuthenticationParameters ) : Promise < AuthResponse > {
380
+ this . logger . verbose ( "AcquireTokenPopup has been called" ) ;
381
+
380
382
// validate request
381
383
const request : AuthenticationParameters = RequestUtils . validateRequest ( userRequest , false , this . clientId , Constants . interactionTypePopup ) ;
382
384
const apiEvent : ApiEvent = this . telemetryManager . createAndStartApiEvent ( request . correlationId , API_EVENT_IDENTIFIER . AcquireTokenPopup ) ;
@@ -385,6 +387,7 @@ export class UserAgentApplication {
385
387
this . acquireTokenInteractive ( Constants . interactionTypePopup , false , request , resolve , reject ) ;
386
388
} )
387
389
. then ( ( resp ) => {
390
+ this . logger . verbose ( "Successfully acquired token" ) ;
388
391
this . telemetryManager . stopAndFlushApiEvent ( request . correlationId , apiEvent , true ) ;
389
392
return resp ;
390
393
} )
@@ -405,6 +408,7 @@ export class UserAgentApplication {
405
408
* To renew idToken, please pass clientId as the only scope in the Authentication Parameters
406
409
*/
407
410
private acquireTokenInteractive ( interactionType : InteractionType , isLoginCall : boolean , request : AuthenticationParameters , resolve ?: any , reject ?: any ) : void {
411
+ this . logger . verbose ( "AcquireTokenInteractive has been called" ) ;
408
412
409
413
// block the request if made from the hidden iframe
410
414
WindowUtils . blockReloadInHiddenIframes ( ) ;
@@ -427,7 +431,14 @@ export class UserAgentApplication {
427
431
}
428
432
429
433
// Get the account object if a session exists
430
- const account : Account = ( request && request . account && ! isLoginCall ) ? request . account : this . getAccount ( ) ;
434
+ let account : Account ;
435
+ if ( request && request . account && ! isLoginCall ) {
436
+ account = request . account ;
437
+ this . logger . verbose ( "Account set from request" ) ;
438
+ } else {
439
+ account = this . getAccount ( ) ;
440
+ this . logger . verbose ( "Account set from MSAL Cache" ) ;
441
+ }
431
442
432
443
// If no session exists, prompt the user to login.
433
444
if ( ! account && ! ServerRequestParameters . isSSOParam ( request ) ) {
@@ -437,7 +448,7 @@ export class UserAgentApplication {
437
448
438
449
// silent login if ADAL id_token is retrieved successfully - SSO
439
450
if ( adalIdToken && ! request . scopes ) {
440
- this . logger . info ( "ADAL's idToken exists. Extracting login information from ADAL's idToken " ) ;
451
+ this . logger . info ( "ADAL's idToken exists. Extracting login information from ADAL's idToken" ) ;
441
452
const tokenRequest : AuthenticationParameters = this . buildIDTokenRequest ( request ) ;
442
453
443
454
this . silentLogin = true ;
@@ -457,11 +468,13 @@ export class UserAgentApplication {
457
468
}
458
469
// No ADAL token found, proceed to login
459
470
else {
471
+ this . logger . verbose ( "Login call but no token found, proceed to login" ) ;
460
472
this . acquireTokenHelper ( null , interactionType , isLoginCall , request , resolve , reject ) ;
461
473
}
462
474
}
463
475
// AcquireToken call, but no account or context given, so throw error
464
476
else {
477
+ this . logger . verbose ( "AcquireToken call, no context or account given" ) ;
465
478
this . logger . info ( "User login is required" ) ;
466
479
const stateOnlyResponse = buildResponseStateOnly ( this . getAccountState ( request . state ) ) ;
467
480
this . cacheStorage . resetTempCacheItems ( request . state ) ;
@@ -474,6 +487,7 @@ export class UserAgentApplication {
474
487
}
475
488
// User session exists
476
489
else {
490
+ this . logger . verbose ( "User session exists, login not required" ) ;
477
491
this . acquireTokenHelper ( account , interactionType , isLoginCall , request , resolve , reject ) ;
478
492
}
479
493
}
0 commit comments