网上找了jwt.dll
代码大致调通了
Dim secret As String = "XXXXXX"
'Dim st As New Date(1970, 1, 1, 8, 0, 0)
'Dim timestamp As Long = (Date.Now - st).TotalMilliseconds()
Dim action_id As String = "601"
Dim provider As jwt.IDateTimeProvider = New jwt.UtcDateTimeProvider()
Dim now = provider.GetNow()
Dim unixEpoch = New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)
Dim secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds)
Dim headers = New Dictionary(Of String, Object)
Dim payload = New Dictionary(Of String, Object) From {
{"exp", secondsSinceEpoch + 1000 * 10},
{"action_id", action_id}
}
Dim key As Byte() = Encoding.UTF8.GetBytes(secret)
'Convert.FromBase64String(str)
Dim algorithm As jwt.algorithms.IJwtAlgorithm = New jwt.algorithms.HMACSHA256Algorithm()
Dim serializer As jwt.IJsonSerializer = New jwt.Serializers.JsonNetSerializer()
Dim urlEncoder As jwt.IBase64UrlEncoder = New jwt.JwtBase64UrlEncoder()
Dim encoder As jwt.IJwtEncoder = New jwt.JwtEncoder(algorithm, serializer, urlEncoder)
Dim token = encoder.Encode(headers, payload, key)
Output.Show(token)
Dim url As String = "https://api.kaoshixing.com/api/company/data/XXXX/?jwt=" & token
Dim jo As New JObject
jo("page") = 1
Dim hc As New HttpClient(url)
hc.Content = jo.ToString()
Dim ss As String = hc.GetData
Output.Show(ss)