title: PayPal REST Api error: response 401 PPConnectionException
body: <p>I'm using the PHP PayPal REST API sandbox and getting errors when I do my <code>$payment-&gt;create( $apiContext );</code></p>
  
  <p>My Error log reads as:</p>
  
  <pre><code>    PHP Fatal error:  Uncaught exception 'PayPal\\Exception\\PPConnectionException' with message 
  
  'Got Http response code 401 when accessing https://api.paypal.com/v1/oauth2/token. 
      Retried 0 times.' in /usr/local/web/servers/domain/guts/paypal_api/vendor/paypal/sdk-core-php/lib/PayPal/Core/PPHttpConnection.php:99\nStack trace:\n
  
  #0 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/Auth/OAuthTokenCredential.php(96): 
      PayPal\\Core\\PPHttpConnection-&gt;execute('grant_type=clie...')\n
  
  #1 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/Auth/OAuthTokenCredential.php(76): 
      PayPal\\Auth\\OAuthTokenCredential-&gt;_generateAccessToken(Array)\n
  
  #2 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/Rest/RestHandler.php(56): PayPal\\Auth\\OAuthTokenCredential-&gt;getAccessToken(Array)\n
  
  #3 /usr/local/web/servers/domain/guts/paypal_api/vendor/paypal/sdk-core-php/lib/PayPal/Transport/PPRestCall.php(41): 
      PayPal\\Rest\\RestHandler-&gt;handle(Object(PayPal\\Core\\PPHttpConfig), '{"intent":"sale...', Array)\n
  
  #4 /usr/local/web/servers/domain/guts/paypal_api/lib/PayPal/A in 
      /usr/local/web/servers/domain/guts/paypal_api/vendor/paypal/sdk-core-php/lib/PayPal/Core/PPHttpConnection.php on line 99, 
      referer: http://domain.com/products/basket/verify/
  </code></pre>
  
  <p>my PayPal.log file shows:</p>
  
  <pre><code>PayPal\Core\PPHttpConnection: Connecting to https://api.paypal.com/v1/oauth2/token
  PayPal\Core\PPHttpConnection: Payload grant_type=client_credentials
  PayPal\Core\PPHttpConnection: Adding header User-Agent: PayPalSDK/rest-sdk-php 0.6.0 (lang=PHP;v=5.3.3;bit=64;os=Linux_2.6.18-348.6.1.el5;machine=x86_64;openssl=0.9.8e-fips-rhel5;curl=7.15.5)
  PayPal\Core\PPHttpConnection: Adding header Authorization: Basic QVpteVVCQ3VfdDhlb3QxcGx0UksyUG56Y3NhcXpOeXNIMlNDLXBDbTlUNGVGNDE3OFd1cFBFRmhkTVpnOkVGZ3g4UkNCZUppSkw3NW1JV1FDRFROTVVsanFOLW1fdlFuM3owMzZOZ3EwTUp3RVFwRkNlV0Z0dWhaag==
  PayPal\Core\PPHttpConnection: Adding header Accept: */*
  </code></pre>
  
  <p>I've tried test cc numbers, cc numbers set up on paypal's sandbox site.  I've tried using the credentials in the demo app provided in rest-api-skd-php-master (the demo works btw).</p>
  
  <p>I can show you my code though it pretty precisely emulates the test case.</p>
  
  <p>The only thing I can think of is that the processing files are buried below www access levels?</p>
  
  <p>If you can clean any info from the error logs I'm all ears.  If there's more info you need from me I can provide it.</p>