/** * @param array $settings * @param array $parameters */ public function authCallback($settings = array(), $parameters = array()) { $error = parent::authCallback($settings, $parameters); if (empty($error)) { // Now post to the metadata URL $data = $this->makeRequest('https://login.mailchimp.com/oauth2/metadata'); return $this->extractAuthKeys($data, 'dc'); } else { return $error; } }
/** * Retrieves and stores tokens returned from oAuthLogin. * * @param array $settings * @param array $parameters * * @return bool|string false if no error; otherwise the error string */ public function authCallback($settings = [], $parameters = []) { // Constanct Contact doesn't like POST $settings['method'] = 'GET'; return parent::authCallback($settings, $parameters); }
/** * @param $url * @param array $parameters * @param string $method * @param array $settings * * @return mixed|string */ public function makeRequest($url, $parameters = [], $method = 'GET', $settings = []) { $settings['headers'] = ['Except:', 'Accept: application/json', 'Content-Type: application/json', 'Api-Version: 2.2', 'Api-AppId: ' . $this->keys['API-AppId'], 'Api-Username: '******'API-Username'], 'API-Password: '******'API-Password']]; return parent::makeRequest($url, $parameters, $method, $settings); }