acquireApiToken(force) {
          force = !!force;

          let vm = this;

          if (this.apiToken && !force) {
            console.log('AUTH: Acquire API Token Succeeded... With Cached Token');
            return new Promise((resolve, reject) => resolve(vm.apiToken));
          }

          this.apiToken = null;
          this.userRoles = [];

          return new Promise((resolve, reject) => {
            if (vm._useFakes) {
              let token =
                'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.' +
                'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.' +
                'SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
              vm.apiToken = token;
              vm.userRoles = vm.userRolesFromApiToken();
              console.log('AUTH: Acquire (fake) API Token Succeeded');
              ctx.$axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
              // console.log('AUTH: Configured axios default header to send API access token');
              return resolve(token);
            }

            vm._context.acquireToken(vm._config.apiId, (errDescription, token, err) => {
              if (errDescription || !token) {
                let msg = `AUTH: Acquire API Token Failed: ${errDescription} [${err}]`;
                console.log(msg);
                return reject(msg);
              } else {
                vm.apiToken = token;
                vm.userRoles = vm.userRolesFromApiToken();
                console.log('AUTH: Acquire new API Token Succeeded');
                ctx.$axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
                // console.log('AUTH: Configured axios default header to send API access token');
                return resolve(token);
              }
            });
          });
        }
/**
         * Acquire a token for calling the app's associated REST API and return it, or return the already-cached token
         * @param {Boolean} force [force=false] When supplied and set to true, (re-)acquire the token even if one is cached
         * @returns {Promise.<String>} A promise that resolves to an ADAL token for API access
         */
Acquire a token for calling the app's associated REST API and return it, or return the already-cached token
@param {Boolean} force [force=false] When supplied and set to true, (re-)acquire the token even if one is cached
@returns {Promise.} A promise that resolves to an ADAL token for API access
Acquire a token for calling the app ' s associated REST API and return it or return the already - cached token @param { Boolean } force [ force = false ] When supplied and set to true ( re - ) acquire the token even if one is cached @returns { Promise . } A promise that resolves to an ADAL token for API access
acquireApiToken(force) {
          force = !!force;
          let vm = this;
          if (this.apiToken && !force) {
            console.log('AUTH: Acquire API Token Succeeded... With Cached Token');
            return new Promise((resolve, reject) => resolve(vm.apiToken));
          }
          this.apiToken = null;
          this.userRoles = [];
          return new Promise((resolve, reject) => {
            if (vm._useFakes) {
              let token =
                'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.' +
                'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.' +
                'SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
              vm.apiToken = token;
              vm.userRoles = vm.userRolesFromApiToken();
              console.log('AUTH: Acquire (fake) API Token Succeeded');
              ctx.$axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
              return resolve(token);
            }
            vm._context.acquireToken(vm._config.apiId, (errDescription, token, err) => {
              if (errDescription || !token) {
                let msg = `AUTH: Acquire API Token Failed: ${errDescription} [${err}]`;
                console.log(msg);
                return reject(msg);
              } else {
                vm.apiToken = token;
                vm.userRoles = vm.userRolesFromApiToken();
                console.log('AUTH: Acquire new API Token Succeeded');
                ctx.$axios.defaults.headers.common['Authorization'] = `Bearer ${token}`;
                return resolve(token);
              }
            });
          });
        }
acquireApiToken ( force ) { force = ! ! force ; let vm = this ; if ( this . apiToken && ! force ) { console . log ( 'AUTH: Acquire API Token Succeeded... With Cached Token' ) ; return new Promise ( ( resolve , reject ) => resolve ( vm . apiToken ) ) ; } this . apiToken = null ; this . userRoles = [ ] ; return new Promise ( ( resolve , reject ) => { if ( vm . _useFakes ) { let token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.' + 'eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.' + 'SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c' ; vm . apiToken = token ; vm . userRoles = vm . userRolesFromApiToken ( ) ; console . log ( 'AUTH: Acquire (fake) API Token Succeeded' ) ; ctx . $axios . defaults . headers . common [ 'Authorization' ] = ` ${ token } ` ; return resolve ( token ) ; } vm . _context . acquireToken ( vm . _config . apiId , ( errDescription , token , err ) => { if ( errDescription || ! token ) { let msg = ` ${ errDescription } ${ err } ` ; console . log ( msg ) ; return reject ( msg ) ; } else { vm . apiToken = token ; vm . userRoles = vm . userRolesFromApiToken ( ) ; console . log ( 'AUTH: Acquire new API Token Succeeded' ) ; ctx . $axios . defaults . headers . common [ 'Authorization' ] = ` ${ token } ` ; return resolve ( token ) ; } } ) ; } ) ; }
Acquire a token for calling the app's associated REST API and return it, or return the already-cached token
 @param {Boolean} force [force=false] When supplied and set to true, (re-)acquire the token even if one is cached
 @returns {Promise.<String>} A promise that resolves to an ADAL token for API access
Acquire a token for calling the app ' s associated REST API and return it or return the already - cached token @param { Boolean } force [ force = false ] When supplied and set to true ( re - ) acquire the token even if one is cached @returns { Promise . <String > } A promise that resolves to an ADAL token for API access
// console.log('AUTH: Configured axios default header to send API access token'); // console.log('AUTH: Configured axios default header to send API access token');