Question

Can't get authentication token since upgrade to 22.04

  • 16 February 2023
  • 5 replies
  • 180 views

Userlevel 1
Badge +5

Hello,
since we last upgrade from 20.10 to 22.04 we have a couple of perl script that fail. It seems as if the URL for the API changed and the authentication token could no be retreive.

This is the request in the script, which worked before the upgrade:


my $resauth = $ua->request(POST "https://${hostname}/centreon/api/index.php?action=authenticate", [username => "$username", password => "$password"]);

 

And the error is:


malformed JSON string, neither tag, array, object, number, string or atom, at character offset 0 (before "<!DOCTYPE HTML PUBLI...") at /opt/clapi/ExportCentreonServices.pl line 75.
 

What can be wrong?

Regards,

Enrique


5 replies

Userlevel 1
Badge +5

Also, using curl for that URL gives 404 Not Found error.

Userlevel 4
Badge +13

đź‘‹

curl

curl "https://x.x.x.x/centreon/api/index.php?action=authenticate" -F "username=\"aaaaa\"" -F "password=\"xxxx\""

or

 

Userlevel 1
Badge +5

Hello ponchoh

 

using curl with the username and password options as you pointed again gives 404 Not Found error.

 

Using the second method on Firefox gives "Unauthorized"

Userlevel 4
Badge +13

I did run it in 22.04 anything in the logs?

Userlevel 1
Badge +5

Hello,

sorry for the late reply.

The script is working again but using http:// instead of https:// to authenticate. Since the script runs in the locally in the central server it is ok for us now.

 

We still don’t know what was broken during the upgrade.

 

Regards,

Enrique

Reply