I trap HTTP 401 in a few of my drivers and re-auth (for an expired JWT in my case, but the same general structure should probably work). Here's an example -- see httpExecWithAuthCheck()
in hubitat_unifiEvents/unifiController at main 路 tomwpublic/hubitat_unifiEvents 路 GitHub
For synchronous HTTP operations (like httpGet()
), Hubitat returns an HttpResponseDecorator. You can get the headers from that response with <response>.getHeaders()
.
It's only slightly more complicated with async HTTP operations, as described here: Async HTTP calls