Android Question How to send digest auth to Shelly relay?

cenyu

Active Member
Licensed User
Longtime User
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:
Top