async check() {
          if (this._useFakes) {
            this.isAuthenticated();
            this.parseUserProfile(this.getUserProfile());
            this.isTenantUser();
            await this.acquireApiToken();
            console.log('AUTH: auth checks (fake) passed');
            return;
          }

          if (this._context.loginInProgress()) {
            console.log('AUTH: auth checks skipped while login in progress');
            return;
          }

          let passedAuthChecks = false;

          try {
            if (this.isAuthenticated()) {
              this.parseUserProfile(this.getUserProfile());

              if (this.isTenantUser()) {
                await this.acquireApiToken();
                passedAuthChecks = true;
              } else {
                console.log('AUTH: user not a tenant user, logging out...');
              }
            }
          } catch (e) {
            console.log('AUTH: error checking auth', e);
          }

          if (passedAuthChecks) {
            console.log('AUTH: auth checks passed');
          } else {
            console.log('AUTH: auth checks failed');
            this.signOut();
          }
        }
/**
         * Perform auth checks and cache user profile info and API token if possible. If auth
         * checks fail, perform sign-out
         */
Perform auth checks and cache user profile info and API token if possible. If auth
checks fail, perform sign-out
Perform auth checks and cache user profile info and API token if possible . If auth checks fail perform sign - out
async check() {
          if (this._useFakes) {
            this.isAuthenticated();
            this.parseUserProfile(this.getUserProfile());
            this.isTenantUser();
            await this.acquireApiToken();
            console.log('AUTH: auth checks (fake) passed');
            return;
          }
          if (this._context.loginInProgress()) {
            console.log('AUTH: auth checks skipped while login in progress');
            return;
          }
          let passedAuthChecks = false;
          try {
            if (this.isAuthenticated()) {
              this.parseUserProfile(this.getUserProfile());
              if (this.isTenantUser()) {
                await this.acquireApiToken();
                passedAuthChecks = true;
              } else {
                console.log('AUTH: user not a tenant user, logging out...');
              }
            }
          } catch (e) {
            console.log('AUTH: error checking auth', e);
          }
          if (passedAuthChecks) {
            console.log('AUTH: auth checks passed');
          } else {
            console.log('AUTH: auth checks failed');
            this.signOut();
          }
        }
async check ( ) { if ( this . _useFakes ) { this . isAuthenticated ( ) ; this . parseUserProfile ( this . getUserProfile ( ) ) ; this . isTenantUser ( ) ; await this . acquireApiToken ( ) ; console . log ( 'AUTH: auth checks (fake) passed' ) ; return ; } if ( this . _context . loginInProgress ( ) ) { console . log ( 'AUTH: auth checks skipped while login in progress' ) ; return ; } let passedAuthChecks = false ; try { if ( this . isAuthenticated ( ) ) { this . parseUserProfile ( this . getUserProfile ( ) ) ; if ( this . isTenantUser ( ) ) { await this . acquireApiToken ( ) ; passedAuthChecks = true ; } else { console . log ( 'AUTH: user not a tenant user, logging out...' ) ; } } } catch ( e ) { console . log ( 'AUTH: error checking auth' , e ) ; } if ( passedAuthChecks ) { console . log ( 'AUTH: auth checks passed' ) ; } else { console . log ( 'AUTH: auth checks failed' ) ; this . signOut ( ) ; } }
Perform auth checks and cache user profile info and API token if possible.
Perform auth checks and cache user profile info and API token if possible .