/** * @return bool|mixed */ public function accessToken() { // check the security - anti csrf token $key = $this->request->getQuery('statekey'); $value = $this->request->getQuery('state'); if (!$this->security->checkToken($key, $value)) { return false; } $this->view->disable(); if ($error = $this->request->getQuery('error')) { $error = Text::humanize($error); $uri = $this->request->getQuery('error_uri'); $this->logger->error("{$error}: " . $this->request->getQuery('error_description') . " (see: {$uri})"); return false; } $params = ['client_id' => $this->clientId, 'client_secret' => $this->clientSecret, 'code' => $this->request->getQuery('code'), 'state' => $this->request->getQuery('state')]; $response = $this->send($this->endPointAccessToken, $params); return $response; }