Ejemplo n.º 1
0
 public function actionAccess_token()
 {
     $server = new OAuthServer();
     /* ----------------------------------------------------------------- */
     $x_auth_mode = $this->module->getParam('x_auth_mode');
     if ($x_auth_mode == 'client_auth') {
         $username = $this->module->getParam('x_auth_username');
         $password = $this->module->getParam('x_auth_password');
         $model = new LoginForm();
         $arr = array('username' => $username, 'password' => $password);
         $model->attributes = $arr;
         if ($model->validate() && $model->login()) {
             $user_id = Yii::app()->user->id;
             $result = $server->xauthAccessToken($user_id);
             echo $result;
             exit;
         }
     }
     /* ----------------------------------------------------------------- */
     $server->accessToken();
     exit;
 }