2014-01-16 102 views
0

我試圖通過Box-Api設置授權過程。第一步必須是一個GET調用授權URL,它具有攜帶三個參數:Web服務Oath2 zend框架1.12

  1. REDIRECT_URL
  2. CLIENT_ID
  3. RESPONSE_TYPE =代碼

這是我的示例代碼這個電話:

class OauthController extends Zend_Controller_Action 
{ 

public function indexAction() 
{ 
       $client = new Zend_Http_Client('https://www.box.com/api/oauth2/authorize'); 
     $client->setMethod(Zend_Http_Client::GET); 
     $client->setParameterGet(array(
       'response_type' => 'code', 
       'client_id' => 'xxxxxxxxxxxxxxxxxx', 
       'redirect_uri'  => 'http://localhost/imball-reagens/callback' 
     )); 
     $response = $client->request(); 
     $this->_helper->viewRenderer->setNoRender(true); 
     return $response; 
} 

} 

我已經在我的網站的主頁鏈接到這個控制器,我已經採取遠離視圖,因此Controller只能執行http呼叫。它應該用Box.com的登錄提醒用戶,但它不會,而是隻顯示一個白頁。 Zend服務器拋出當我把這個控制器警告:

Slow Request Execution 

Request to http://localhost:10088/imball-reagens/public/oauth took 3042ms 

回答

0

的過程已在主頁上的鏈接被寫入。這個例子:

<a href="https://www.box.com/api/oauth2/authorize?response_type=code&client_id=xxxxxxxxx&redirect_uri=http://localhost/callback">Authorize Account Box API</a>