/** * redirect to authorize endpoint of service */ public function authorize(array $userParameters = array()) { $parameters = array_merge($userParameters, array('type' => 'web_server', 'client_id' => $this->_client->getClientKey(), 'redirect_uri' => $this->_client->getCallbackUrl(), 'response_type' => 'code')); if ($this->_scope) { $parameters['scope'] = $this->_scope; } $url = $this->_configuration->getAuthorizeEndpoint(); $url .= (strpos($url, '?') !== false ? '&' : '?') . http_build_query($parameters); header('Location: ' . $url); die; }
/** * redirect to authorize endpoint of service */ public function authorize(array $userParameters = array()) { $parameters = array_merge($userParameters, array('type' => 'web_server', 'client_id' => $this->_client->getClientKey(), 'response_type' => 'code')); if ($this->_scope) { $parameters['scope'] = $this->_scope; } if ($this->_client->getCallbackUrl()) { $parameters['redirect_uri'] = $this->_client->getCallbackUrl(); $url = $this->_configuration->getAuthorizeEndpoint(); $url .= (strpos($url, '?') !== false ? '&' : '?') . http_build_query($parameters); header('Location: ' . $url); die; } else { $http = new HttpClient($this->_configuration->getAuthorizeEndpoint(), 'POST', http_build_query($parameters)); //$http->setDebug(true); $http->execute(); $this->_getAuthorizeCode($http); } }