private function accessTokenRequest(array $p)
 {
     if ($this->clientConfig->getCredentialsInRequestBody()) {
         // provide credentials in the POST body
         $p['client_id'] = $this->clientConfig->getClientId();
         $p['client_secret'] = $this->clientConfig->getClientSecret();
     } else {
         // use basic authentication
         $this->httpClient->setBasicAuth($this->clientConfig->getClientId(), $this->clientConfig->getClientSecret());
     }
     try {
         $this->httpClient->addHeader('Accept', 'application/json');
         $this->httpClient->addPostFields($p);
         $responseData = $this->httpClient->post($this->clientConfig->getTokenEndpoint());
         // some servers do not provide token_type, so we allow for setting
         // a default
         // issue: https://github.com/fkooman/php-oauth-client/issues/13
         if (null !== $this->clientConfig->getDefaultTokenType()) {
             if (is_array($responseData) && !isset($responseData['token_type'])) {
                 $responseData['token_type'] = $this->clientConfig->getDefaultTokenType();
             }
         }
         // if the field "expires_in" has the value null, remove it
         // issue: https://github.com/fkooman/php-oauth-client/issues/17
         if ($this->clientConfig->getAllowNullExpiresIn()) {
             if (is_array($responseData) && array_key_exists('expires_in', $responseData)) {
                 if (null === $responseData['expires_in']) {
                     unset($responseData['expires_in']);
                 }
             }
         }
         // if the field "scope" is empty string a default can be set
         // through the client configuration
         // issue: https://github.com/fkooman/php-oauth-client/issues/20
         if (null !== $this->clientConfig->getDefaultServerScope()) {
             if (is_array($responseData) && isset($responseData['scope']) && '' === $responseData['scope']) {
                 $responseData['scope'] = $this->clientConfig->getDefaultServerScope();
             }
         }
         // the service can return a string value of the expires_in
         // parameter, allow to convert to number instead
         // issue: https://github.com/fkooman/php-oauth-client/issues/40
         if ($this->clientConfig->getAllowStringExpiresIn()) {
             if (is_array($responseData) && isset($responseData['expires_in']) && is_string($responseData['expires_in'])) {
                 $responseData['expires_in'] = intval($responseData['expires_in']);
             }
         }
         if ($this->clientConfig->getUseCommaSeparatedScope()) {
             if (is_array($responseData) && isset($responseData['scope'])) {
                 $responseData['scope'] = str_replace(',', ' ', $responseData['scope']);
             }
         }
         // issue: https://github.com/fkooman/php-oauth-client/issues/41
         if ($this->clientConfig->getUseArrayScope()) {
             if (is_array($responseData) && isset($responseData['scope'])) {
                 if (is_array($responseData['scope'])) {
                     $responseData['scope'] = implode(' ', $responseData['scope']);
                 }
             }
         }
         return new WPOF_Token_Response($responseData);
     } catch (RuntimeException $e) {
         return false;
     }
 }