protected function beforeRun($action, $params, $render) { $this->client = new \GO\Googledrive\Client(); $this->client->setRedirectUri(\GO::url($this->getRoute("connect"), array(), false, false, false)); $this->service = new Google_DriveService($this->client); $token = \GO::config()->get_setting('googledrive_token', \GO::user()->id); if ($token) { $this->client->setAccessToken($token); } return parent::beforeRun($action, $params, $render); }