dist/origin-web-common-services.js
function(config) {
      // Requests that don't require auth can continue
      if (!AuthService.requestRequiresAuth(config)) {
        // console.log("No auth required", config.url);
        return config;
      }

      // If we could add auth info, we can continue
      if (AuthService.addAuthToRequest(config)) {
        // console.log("Auth added", config.url);
        return config;
      }

      // We should have added auth info, but couldn't

      // If we were specifically told not to trigger a login, return
      if (config.auth && config.auth.triggerLogin === false) {
        return config;
      }

      // 1. Set up a deferred and remember this config, so we can add auth info and resume once login is complete
      var deferred = $q.defer();
      pendingRequestConfigs.push([deferred, config, 'request']);
      // 2. Start the login flow
      AuthService.startLogin();
      // 3. Return the deferred's promise
      return deferred.promise;
    }
function(config) {
      // Requests that don't require auth can continue
      if (!AuthService.requestRequiresAuth(config)) {
        // console.log("No auth required", config.url);
        return config;
      }

      // If we could add auth info, we can continue
      if (AuthService.addAuthToRequest(config)) {
        // console.log("Auth added", config.url);
        return config;
      }

      // We should have added auth info, but couldn't

      // If we were specifically told not to trigger a login, return
      if (config.auth && config.auth.triggerLogin === false) {
        return config;
      }

      // 1. Set up a deferred and remember this config, so we can add auth info and resume once login is complete
      var deferred = $q.defer();
      pendingRequestConfigs.push([deferred, config, 'request']);
      // 2. Start the login flow
      AuthService.startLogin();
      // 3. Return the deferred's promise
      return deferred.promise;
    }
function ( config ) { // Requests that don't require auth can continue if ( ! AuthService . requestRequiresAuth ( config ) ) { // console.log("No auth required", config.url); return config ; } // If we could add auth info, we can continue if ( AuthService . addAuthToRequest ( config ) ) { // console.log("Auth added", config.url); return config ; } // We should have added auth info, but couldn't // If we were specifically told not to trigger a login, return if ( config . auth && config . auth . triggerLogin === false ) { return config ; } // 1. Set up a deferred and remember this config, so we can add auth info and resume once login is complete var deferred = $q . defer ( ) ; pendingRequestConfigs . push ( [ deferred , config , 'request' ] ) ; // 2. Start the login flow AuthService . startLogin ( ) ; // 3. Return the deferred's promise return deferred . promise ; }
If auth is not needed, or is already present, returns a config If auth is needed and not present, starts a login flow and returns a promise of a config
If auth is not needed or is already present returns a config If auth is needed and not present starts a login flow and returns a promise of a config