4 posts / 0 new
Last post
Problems with self hosted OVMS server

I have installed my own v2 server. Works fine with OVMS v3 Module and the android app.

But 1 have some problems.

Problem 1. If I try to use the http api to get the vehicle list I get an authentication failed. I tried both with the admin user and the password from the OVMS module

and also the vehicle id and it's carpass and userpass, see mysql table below.

*   Trying xxxx:6869...
* Connected to xxxx (xxxx) port 6869 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=xxxx
*  start date: Mar 20 10:57:32 2022 GMT
*  expire date: Jun 18 10:57:31 2022 GMT
*  subjectAltName: host "xxxx" matched cert's "*.xxxx"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Server auth using Basic with user 'admin'
> GET /api/vehicles HTTP/1.1
> Host: xxxx:6869
> Authorization: Basic xxxx
> User-Agent: curl/7.82.0
> Accept: */*
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
* HTTP 1.0, assume close after body
< HTTP/1.0 401 Unauthorized
< Access-Control-Allow-Origin: *
< Content-Length: 22
< Connection: close
< Cache-Control: max-age=0
< Date: Wed, 04 May 2022 15:40:07 GMT
< Content-Type: text/plain
< Expires: Wed, 04 May 2022 15:40:07 GMT
Authentication failed
* Closing connection 0
* TLSv1.3 (OUT), TLS alert, close notify (256):

MariaDB [openvehicles]> select * from ovms_cars;
| vehicleid | vehiclename | owner | telephone | carpass  | userpass | cryptscheme | v_ptoken | v_server | v_type | deleted | changed             | v_lastupdate        | couponcode |
| xxxx      |                        |     1     |                  | xxxx       | xxxxxx     |             |          |          |        |       0 | 1900-01-01 00:00:00 | 2022-05-04 15:43:17 |            |

Problem 2. I cannot access any GUI via any of the ports 6867, 6868, 6869, 6870 using a browser.

The two problems might be related this is why I choose to put them together.

I looked into all mysql tables and couldn't find any other username password combination I could have tried.

These are all tables in the database:

MariaDB [openvehicles]> show tables;
| Tables_in_openvehicles  |
| ovms_apitokens          |
| ovms_autoprovision      |
| ovms_carmessages        |
| ovms_cars               |
| ovms_historicalmessages |
| ovms_notifies           |
| ovms_owners             |
7 rows in set (0.001 sec)




markwj's picture
HTTP authentication is

HTTP authentication is typically via username+password from the ovms_owners table. But that depends on what plugin you have configured to do it. The ApiHttpCore calls the overloaded plugin function 'Authenticate' to perform the authentication.

You either need to use the supplied AuthDrupal plugin (which espects drupal style strongly hashed passwords in ovms_owners table), or write your own (registering and providing the 'Authenticate' function. You can use AuthDrupal as an example.

Problem 1:

Problem 1:

You need to add your username and password on your call. Because you dont write your request, here is an example from myself:


Like markwj wrote, you need to add user from Drupal auth or manually set in ovms_owners table to your GET request. You can use cookie based authenticaton too, described in OVMS documentation.

Problem 2:

The OVMS server has no webinterface. You need to install Drupal and provided Drupal plugin, to register your account and vehicle.

Thanks for this! Was having

Thanks for this! Was having the same problem and found this thread. I was chasing down the lack of a 'permission' variable -  as the code was erroring out due to this being empty/uninit, but for life of me could not map out value in the database to explain that :) 


I took the advice of taking the drupalAuth which is in the git repo and modifying it to basically compare non-hashed password in the DB vs my request -- (Basically change $encoded eq $dbpass to $password eq $dbpass -- and remove unused codes/errors). This is not secure by any means, but once I had that working can go back and decide how/if I want to hash the password in the DB or not. For local testing though was a quick to see a functional http API.  Don't forget if you change the filename to change your package name to match.

Log in or register to post comments