[SOLVED] OH3: add additional user for basic auth API requests

Hi
I need to use user/pwd auth for an API POST call (POST item) because the device does only support this auth type.
I enabled “Allow Basic Authentication” in API Security, but I cannot figure out how to provide the credentials (or the issue is a special character in the pwd? I have a ! in it).
Additinally, is it possible to add an additional user, or do I have to use the default admin user defined at setup ?

This is my curl call (user/pwd/hostIP/port masked):

curl -v -X POST -H "Content-Type: text/plain" "http://user:password@hostIP:port/rest/items/dingzButton3Single"

The result should be a “received command” in the event log.

REMARK: the call is working with API-Token

curl -v -X POST -H "Content-Type: text/plain"  "http://hostIP:port/rest/items/dingzButton3Single?access_token=myToken"

EDIT:
The issue was caused by the ! character in the pwd. With a simpler pwd it works.
But I’m stll interested if it is possible to add an additional user ?

Searching the forum finds you can do that through the Karaf console.

Try as described here: Is openhab 3 multiuser? - #5 by Udo_Hartmann

openhab> openhab:users add udo mypassword user
udo (user)
User created.
openhab> openhab:users list
openhab (administrator)
udo (user)
openhab> openhab:users remove udo
User removed.
openhab>

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.