title: Confirming PayPal payment using Parse.com cloud code
body: <p>In order to confirm payments I need an access_token which expires every 8 hours so I need to fetch a new access token with cloud code before I try to verify a payment.</p>
  
  <p>I am trying to use a httpRequest:</p>
  
  <pre><code>function requestAccessToken(response){
          Parse.Cloud.httpRequest({
              method: 'POST',
              url: 'https://api.paypal.com/v1/oauth2/token',
              headers: {
                  'Content-Type': 'application/json',
                  'Accept-Language' : 'en_US'
              },
              body: 'grant_type=client_credentials',
              success: function(httpResponse) {
                  var res = JSON.parse(httpResponse.text);
                  response.success(res.access_token);
              },
              error: function(httpResponse) {
                  response.error('requestAccessToken failed with response code ' + httpResponse.status);
              }
          });
      }
  </code></pre>
  
  <p>To do the following curl (<a href="https://developer.paypal.com/docs/integration/direct/make-your-first-call/" rel="nofollow">from docs</a>):</p>
  
  <pre><code>curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
    -H "Accept: application/json" \
    -H "Accept-Language: en_US" \
    -u "{client-ID}:{secret}" \
    -d "grant_type=client_credentials"
  </code></pre>
  
  <p>The problem is that I can't find a way to add the "{client-ID}:{secret}" to the httpRequest.</p>
  
  <p>using <code>url: 'https://'+clientId+':'+secret+'@api.paypal.com/v1/oauth2/token'</code> results in a 500 server response.</p>
  
  <p>Any Ideas how I can get an access token to verify the payments?</p>