Login validated but API failed

Discussion topics related to mobile applications and ZoneMinder Event Server (including machine learning)
Post Reply
detxm80
Posts: 38
Joined: Fri Oct 13, 2017 9:42 am

Login validated but API failed

Post by detxm80 »

Hi guys,
i've a problem with my zonminder server and zmninja app. All ok by my pc, but if i want to set my zmninja app i get this error:

Login validated but API failed

log:

Code: Select all

Mar 13, 2020 11:52:14 AM INFO API login error {"status":-1,"error":"The operation couldn’t be completed. Protocol error"}
Mar 13, 2020 11:52:14 AM DEBUG ***  Inside native HTTP error for url:undefined
Mar 13, 2020 11:52:14 AM INFO Validating APIs at https://xxx.xx.xx/zm/api/host/getVersion.json?
Mar 13, 2020 11:52:14 AM DEBUG zmAutoLogin: Inside auth-error broadcast
Mar 13, 2020 11:52:14 AM INFO zmAutologin Error {"status":-1,"error":"The operation couldn’t be completed. Protocol error"} and status undefined
Mar 13, 2020 11:52:14 AM DEBUG Not intercepting as skipIntercept is true
Mar 13, 2020 11:52:14 AM DEBUG ***  Inside native HTTP error for url:undefined
Mar 13, 2020 11:52:14 AM INFO Recaptcha failed, but assuming ZM has recaptcha disabled
Mar 13, 2020 11:52:14 AM DEBUG ***  Inside native HTTP error for url:undefined
Mar 13, 2020 11:52:14 AM DEBUG Logging in using old web-scrape method
Mar 13, 2020 11:52:14 AM DEBUG obfuscate: original:5148 obfuscated:1321 scheme:lzs
Mar 13, 2020 11:52:14 AM INFO API based login not supported, need to use web scraping...
Mar 13, 2020 11:52:14 AM DEBUG Not intercepting as skipIntercept is true
Mar 13, 2020 11:52:14 AM DEBUG ***  Inside native HTTP error for url:undefined
Mar 13, 2020 11:52:14 AM INFO Doing fresh login to ZM
thank you
rockedge
Posts: 1178
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Login validated but API failed

Post by rockedge »

what happens if you in a browser manually test the API with
https://xxx.xx.xx/zm/api/host/getVersion.json or http://xxx.xx.xx/zm/api/host/getVersion.json?

first open the ZM web console and login then try the above..you should see a response with the API and ZM version

Also what version of OS? version of zmNinja and version of ZM? Then lets go from there
detxm80
Posts: 38
Joined: Fri Oct 13, 2017 9:42 am

Re: Login validated but API failed

Post by detxm80 »

rockedge wrote: Fri Mar 13, 2020 1:16 pm what happens if you in a browser manually test the API with
https://xxx.xx.xx/zm/api/host/getVersion.json or http://xxx.xx.xx/zm/api/host/getVersion.json?

first open the ZM web console and login then try the above..you should see a response with the API and ZM ver
Also what version of OS? version of zmNinja and version of ZM? Then lets go from there
Hi rockedge, thanks for your reply!

the response is:

Code: Select all

{"version":"1.34.6","apiversion":"2.0"}
OS:

Code: Select all

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic

on VM ON PROXMOX
PHONE OS:

ios 13.3.1

zmNinja version: 1.3.089
Last edited by detxm80 on Fri Mar 13, 2020 6:32 pm, edited 1 time in total.
detxm80
Posts: 38
Joined: Fri Oct 13, 2017 9:42 am

Re: Login validated but API failed

Post by detxm80 »

if a try this:

curl -XPOST -d "user=admin&pass=password" https://<ipaddress>/zm/api/host/getVersion.json

this is output:

Code: Select all

curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above

rockedge
Posts: 1178
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Login validated but API failed

Post by rockedge »

I see, I think in the docs on the API the authorization methods are updated. Do you have the Options->System->OPT_USE_LEGACY_API_AUTH enabled?


Have you checked out https://zoneminder.readthedocs.io/en/1.32.3/api.html? It has some good tips for communicating with the API
gregthegeek
Posts: 3
Joined: Wed Apr 22, 2020 7:25 pm

Re: Login validated but API failed

Post by gregthegeek »

FYI I had this exact problem and could not get zmNinja working with a new ZM install. I setup my own SSL certs and then everything started to work fine. I didn't find this thread till now or I would have tried the legacy api auth option first, but I still wanted my own cert anyway.
Post Reply