Hey guys,
I'm trying to get my ESPEasy Generic HTTP Advanced controller to connect to InfluxDB v2. This is the header that I am specifying:
I get the following error message:
3117316 : Error : HTTP : C011 POST... HTTP code: 401 {"code":"unauthorized","message":"unauthorized access"}
Here is the POST in Wireshark:
Here is the response in Wireshark:
Also, the following CURL command works great:
curl.exe -i -XPOST "http://localhost:8086/api/v2/write?org= ... recision=s" --header "Authorization: Token qcyFqXX5fgYgv4FudNN7n_9Y9KfjwVJ0keUuSR_srlkZfUD6T6Sa1tN4e__BE4d56-SXUHZNfKyq6heAx3-lCQ==" --data-binary "Environment,device=ESP32,taskname=BME280 humidity=28.5,temperature=24.5,pressure=102.3 1645156813"
Have I configured the HTTP header correctly for the authorization?
Thanks in advance,
Fodome
Trouble authenticating into InfluxDB v2
Moderators: grovkillen, Stuntteam, TD-er
Re: Trouble authenticating into InfluxDB v2
Can you check if ESPEasy is set to wait for an acknowledgement?
For SendToHttp like commands, make sure to check (Tools->Advanced) "SendToHTTP wait for ack"
In the controller, it is part of the controller settings, but maybe best to also check the option in the Tools->Advanced page.
For SendToHttp like commands, make sure to check (Tools->Advanced) "SendToHTTP wait for ack"
In the controller, it is part of the controller settings, but maybe best to also check the option in the Tools->Advanced page.
Re: Trouble authenticating into InfluxDB v2
And do you also have a wireshark capture of what is sent/received when using the curl command?
Re: Trouble authenticating into InfluxDB v2
I did set the controller to wait for an acknowledgement, but even then I am getting the same error message as before.
I do not have an advanced section in my tools page. I'm using the custom ESPEasy configuration with just the BME280 plugin and a few controllers (Domoticz HTTP, Domoticz MQTT, Generic HTTP and Generic HTTP Advanced), so I cannot check for the wait for acknowledgement there.
When I use curl, this is the POST that I get: And this is the response:
I do not have an advanced section in my tools page. I'm using the custom ESPEasy configuration with just the BME280 plugin and a few controllers (Domoticz HTTP, Domoticz MQTT, Generic HTTP and Generic HTTP Advanced), so I cannot check for the wait for acknowledgement there.
When I use curl, this is the POST that I get: And this is the response:
Re: Trouble authenticating into InfluxDB v2
Your OP has "Authorization: Basic <username> Credentials: : " with response "Unauthorized" (status code 401), and your Curl attempt uses "Authorization: Token <tokendata>" that is accepted (status code 204), so your manually pasted Authorization in the Header apparently isn't overwriting the default username/password.
/Ton (PayPal.me)
Re: Trouble authenticating into InfluxDB v2
It is really hard to create an ESPEasy that doesn't have that Advanced settings page, why would you want to do that? The smaller .bin size won't make it run faster, but only makes it harder to configure things, as that page has a lot of settings that can help you out when facing issues, like above.fodome wrote: ↑01 Mar 2022, 15:47 I do not have an advanced section in my tools page. I'm using the custom ESPEasy configuration with just the BME280 plugin and a few controllers (Domoticz HTTP, Domoticz MQTT, Generic HTTP and Generic HTTP Advanced), so I cannot check for the wait for acknowledgement there.
That doesn't mean the solution is there, but having that makes finding a solution easier.
/Ton (PayPal.me)
Re: Trouble authenticating into InfluxDB v2
Hi,
I just found this post when trying to use influxdbv2 as well.
As it seems, it is currently not possible to _not_ send the basic auth information from the Credentials section.
I guess this this a bug and the header should not be sent or it should be taken from the Header field when Use Extended Credentials is unchecked.
Influxdb v2 will still accepts basic auth when used with the v1 legacy api. So this is my workaround:
Create a influxdb v1 user with
Create a db to bucket mapping with
Add username and password to the controller-settings
Put the v1 endpoint and the newly mapped db-name into the URI field:
Cheers, Jörg
I just found this post when trying to use influxdbv2 as well.
As it seems, it is currently not possible to _not_ send the basic auth information from the Credentials section.
I guess this this a bug and the header should not be sent or it should be taken from the Header field when Use Extended Credentials is unchecked.
Influxdb v2 will still accepts basic auth when used with the v1 legacy api. So this is my workaround:
Create a influxdb v1 user with
Code: Select all
influx v1 auth create
Code: Select all
influx v1 dbrp create
Put the v1 endpoint and the newly mapped db-name into the URI field:
Code: Select all
/write?db=<DBNAME>
Cheers, Jörg
Who is online
Users browsing this forum: Ahrefs [Bot] and 7 guests