Android Question Trust error with GET on HTTP

sirjo66

Well-Known Member
Licensed User
Longtime User
Hello to all,
I need to execute a GET via HTTP protocol with OkHttp with referer and user-agent parameters.

If I develop it with VB.NET it works and the server answer to me correctly, but if I try to it with B4A, with this code:
B4X:
Dim hc As OkHttpClient
hc.Initialize("hc")

Dim req As OkHttpRequest
req.InitializeGet("https://MyPageToCall.com")
req.SetHeader("referer", "http://MyPageForReferer.html")
req.SetHeader("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0")
hc.Execute(req, 1)

If I run this code (with correct parameters) hc_ResponseError function is call with
Reason = javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

How can I solve it ??

Thanks
Sergio
 

sirjo66

Well-Known Member
Licensed User
Longtime User
Ok, as I wrote it works using hc.InitializeAcceptAll("hc") but another user write to me:

Hey mate, be careful with this, because google monitor this behavior and later they can add app as danger.
Try to add some logic inside just for hosts that you need it.

Have you information about it ??
 
Upvote 0
Top