public function authorize(Req $req, Res $res, $args) { $grant_type = $req->getInput('grant_type'); $client_id = $req->getServerParam('PHP_AUTH_USER'); $client_secret = $req->getServerParam('PHP_AUTH_PW'); $oauth = new Oauth(); $result = $oauth->get_token($client_id, $client_secret, $grant_type); return $res->authorize_output($result); }