I should probably look at making a PR to ESP32's HTTP client to add support for setting the Authorization
header to an arbitrary(ish) string so that Bearer tokens and the like can be provided.
Currently, it only supports Basic Authentication.
It looks as though I'm not the only one to have run into this, arduino-esp32 4687 refers to it but doesn't seem to have got any traction.
Activity
18-Jun-23 08:14
assigned to @btasker
19-Jun-23 11:24
Oh actually, it looks like it might be supported after all, if not massively intuitive.
It's not possible to do
because that ends up sending an invalid header:
But, it turns out that there's a second method
Which results in the header being set correctly
So, I was mistaken and it is in fact possible to add a bearer token to a HTTP request generated with the ESP32 HTTP client.