05/01/2023 11:17 (*.17.160.158)
3578

It is pretty easy to apply

 

Dim WEB = New Net.WebClient()

WEB.Headers("Content-Type") = "application/json"
WEB.Headers("Authorization") = "Bearer " & varToken

Try
    result = WEB.UploadString(varURL&, "POST", "")
 Catch ex As Exception
    Return ("")
End Try

Return result

 

Just add a token into header, and can access URL

 

 

There are so many web base devices, and some webserver device do not have a valid certification,

While access HTTPS using Webclient, will get a trouble with Certification if there is no valid one.

When I access Envoy Local Servier using HTTPS, I have expericed it.

 

First, create a Validation Server Function as below

 

Public Function ValidateServerCertificate(ByVal sender As Object, ByVal certificate As Object, ByVal chain As Object, ByVal sslPolicyErrors As Net.Security.SslPolicyErrors) As Boolean


        Return True


End Function

 

And, Connect the validate server as

 

Net.ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate)

 

When call HTTPS using Webclient, Webclient server will call the user defined server code, and can over-ride an error 

 

You can put the code into MAIN() -0r-  Sub New() once

04/30/2023 10:51 (*.17.160.158)
8024

From Evnvoy FW7, Just can login into Enovy using Bearer Token,

 

I have made a simple code using VB.NET to

    (1) Retrieve a Token from Enphase Token Website

    (2) Using the Token, access Enovy's Data

 

Note. Need to add a certification validating code for Envoy, because envoy's certification is not valid.

Note. Ihave added json.vb for JSON file decord and using in the code