/** performs standard authentication, authorizing the relevant token if necessary */ public function actionAuthenticate() { $u = parent::actionAuthenticate(); if (isset($u)) { try { //create oauth token $token = DTOAuthToken::upsert($this->db->qb()->fail(), array("type" => 0, "status" => 1, "user_id" => $u["id"])); $redirect_uri = $this->params->stringParam("redirect_uri"); $state = $this->params->stringParam("state"); $url = $this->appendParams($redirect_uri, array("code" => $token["token"], "state" => $state)); DTLog::debug($url); header('HTTP/1.1 278 Client Redirect', true, 278); return array("location" => $url); } catch (Exception $e) { DTLog::Debug("auth error: " . $e->getMessage()); } //the user failed to authenticate (maybe bad user/pass) } return $u; }