/** * Login page * * @return void */ public function login() { $config = $this->application->config('oauth'); $request = $this->application->request(); $error = false; if ($request->isPost()) { // handle submission of login form // make a call to the api with granttype=password $username = $request->post('username'); $password = $request->post('password'); $redirect = $request->post('redirect'); $clientId = $config['client_id']; $clientSecret = $config['client_secret']; $authApi = new AuthApi($this->cfg, $this->accessToken); $result = $authApi->login($username, $password, $clientId, $clientSecret); $this->handleLogin($result, $redirect); } $this->application->redirect('/'); }