title: AngularJS: multiple $http request and .then promises returns undefined
body: <p>I don't get the response from my second http request after trying to make two http requests in a row with AngularJS. </p>
  
  <p>I have this code: </p>
  
  <pre><code>        createBucket: function (bucketKey, policyKey) {
  
              // get token from json file
              return $http({
                  url: tokenUrl
              })
              .then(function (response) {
                  token = response.data;
                  console.log('refreshing access token');
                  console.log(token);
              })
              .then(function (response) {
  
                  // use token to create new bucket
                  $http({
                      method: 'POST',
                      headers: {
                          "Authorization": token.token_type + " " + token.access_token
                      },
                      url: "https://developer.api.autodesk.com/oss/v2/buckets",
                      data: {
                          "bucketKey": bucketKey,
                          "policyKey": policyKey
                      }
  
                  });
  
              }).then(processResponse);
          },
  </code></pre>
  
  <p>First I do one http request getting a json file. Then using the information in this json file, I do another http request, the result of this request I want to return. In this final code:</p>
  
  <pre><code>    // Send the data part of the response
      function processResponse(response) {
          console.log('response:');
          console.log(response);
          return response.data;
      }
  </code></pre>
  
  <p>the response here is <em>undefined</em>.. I don't know why...</p>