Hello,
I followed the documentation to get the API running, but an example call returns an HTML page instead of the expected data.
My PHP code is
<?php
$fullUrl = "http://localhost:3000/api/Ticket/list/all";
$username = "my_username";
$password = "my_password";
$curl = curl_init($fullUrl);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$curl_response = curl_exec($curl);
echo $curl_response;
curl_close($curl);
?>
And the answer from ProjeQtOr is
ProjeQtOr
var isNewGui=true;
dojo.addOnLoad(function(){
changeTheme('ProjeQtOrFlatGrey ProjeQtOrNewGui');
setColorTheming('#3e5876','#ef4227');
});
function autoRedirect() {
window.setTimeout("document.getElementById('indexForm').submit()",10);
}
(function() {
dojo.byId('currentWidth').value= screen.width;
})();
Thanks already for the support.
It seems the .htAccess is not applied as defined in the api folder.
Note that if you use NGINX, you'll have to add the features in the virtualhost
I copied the .htaccess file from the api folder to /var/www/projeqtor. Its content is
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?uri=$1AuthUserFile "./.htpasswd"
AuthName "ProjeQtOr"
AuthType Basic
require valid-user
Here are the error logs from Apache when the requests is performed, I'm not too sure wht it means :
[Thu Feb 22 10:10:46.486813 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : denied (no authenticated user yet)
[Thu Feb 22 10:10:46.486835 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of : denied (no authenticated user yet)
[Thu Feb 22 10:10:46.486949 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : granted
[Thu Feb 22 10:10:46.486950 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of : granted
[Thu Feb 22 10:10:46.487001 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : denied (no authenticated user yet)
[Thu Feb 22 10:10:46.487003 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of : denied (no authenticated user yet)
[Thu Feb 22 10:10:46.487108 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of Require valid-user : granted
[Thu Feb 22 10:10:46.487109 2024] [authz_core:debug] [pid 366] mod_authz_core.c(815): [client 127.0.0.1:38352] AH01626: authorization result of : granted
When you call the API, you must provide a valid user account (with basic authent) as provided in .htPasswd file.
Yes, the username and password were defined in the .htpasswd using the htpasswd command and they match an admin user defined in ProjeQtor.
Possible,
but you have to provide this on the API call.
Isn't this done in the PHP code ? I pasted it in my first message.
