cenyu Active Member Licensed User Longtime User Jul 6, 2025 #1 Hi friends, i have small code witch have to open an shelly relay. Everithing is right except sending. My starting point was this post : https://www.b4x.com/android/forum/threads/http-digest-authorization-fails-in-b4a.158831/ My code is this: B4X: Dim req As OkHttpRequest Dim authHeader As String = $""Digest username=\"${username}\", realm=\"${realm}\", nonce=\"${nonce}\", uri=\"${uri}\", algorithm=\"${algorithm}\", qop=auth, nc=${nc}, cnonce=\"${cnonce}\", response=\"${response}\"""$ Log("Authorization header: " & authHeader) req.InitializeGet(url) req.SetHeader("Authorization", authHeader) hc.Execute(req, 1) but can't send authorized request to relay. Maybe OkHttpRequest is not rigtn lib? I receive only Unauthorized, Code: 401 :-( Last edited: Jul 6, 2025
Hi friends, i have small code witch have to open an shelly relay. Everithing is right except sending. My starting point was this post : https://www.b4x.com/android/forum/threads/http-digest-authorization-fails-in-b4a.158831/ My code is this: B4X: Dim req As OkHttpRequest Dim authHeader As String = $""Digest username=\"${username}\", realm=\"${realm}\", nonce=\"${nonce}\", uri=\"${uri}\", algorithm=\"${algorithm}\", qop=auth, nc=${nc}, cnonce=\"${cnonce}\", response=\"${response}\"""$ Log("Authorization header: " & authHeader) req.InitializeGet(url) req.SetHeader("Authorization", authHeader) hc.Execute(req, 1) but can't send authorized request to relay. Maybe OkHttpRequest is not rigtn lib? I receive only Unauthorized, Code: 401 :-(
Erel B4X founder Staff member Licensed User Longtime User Jul 7, 2025 #2 cenyu said: Maybe OkHttpRequest is not rigtn lib? Click to expand... That's for sure. You should use OkHttpUtils2. Upvote 0
cenyu said: Maybe OkHttpRequest is not rigtn lib? Click to expand... That's for sure. You should use OkHttpUtils2.