I'm using ESP32 DevKitC and try to implement http basic authentication.
The example code of ESP HTTP Client Example works fine.
It accesses a HTTP basic authentication by prepending username:password@ to the hostname in the URL .
Code: Select all
esp_http_client_config_t config = {
.url = "http://user:passwd@httpbin.org/basic-auth/user/passwd",
.event_handler = _http_event_handler,
.auth_type = HTTP_AUTH_TYPE_BASIC,
};
So I try to use config authentication example with username, password entry instead, like following:
Code: Select all
esp_http_client_config_t config = {
.url = "http://httpbin.org/basic-auth/user/passwd",
.username = "user",
.password = "passwd",
.auth_type = HTTP_AUTH_TYPE_BASIC,
};
https://esp-idf.readthedocs.io/zh_CN/la ... word-entry
But no luck with this config, the module would send the http request without "Authorization" filed in the header.
I'm using the lasted esp-idf.
Could you help to check this?
Thanks!