So with URLConnection I am trying to validate what I have set in my requestHeaders and my SetRequestContent. The debugger for the URLConnection class does not give me this info like HTTPSecureSocket did. Am I missing something to validate this info before I post?
I was afraid of that being the case – URLConnection is not sending the headers properly using JWT (my token is signature verified) but I get a 400 from my server. CURL works fine with my same JWT info and same headers.
Now Im am stuck with troubleshooting as Wireshark is useless as TLS encrypts the details after the POST.
Self.RequestHeader(“Accept”) = “/”
Var hrStr as String = "Bearer " + thisAuthHeader
Self.RequestHeader(“Authorization”) = hrStr
Self.RequestHeader(“Content-Type”) = “application/json”
HrStr has a JWT string value of Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzZWNyZXQiOiJleUowZVhBaU9pSktWMVFpTENKaGJHY2lPaUpJVXpJMU5pSjkiLCJpc3MiOiIifQ.W94d8w2uoWu5HAqJ4UfmVUeUHMkySzje8GXmbFz2gho
Perhaps you need a user-agent, your calling an API right?
Did you copy and paste the string? Try to clean the string value with the bearer.
Select it in (including the quotes) the ide then right click -> clean invisible characters
If you’r generating it i don’t see a problem with this…
Var thisAuthHeader as String = createJWT(ourSecretStr, ourIssStr)
Self.RequestHeader("Accept") = "*/*"
Self.RequestHeader("User-Agent") = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36"
Var hrStr as String = "Bearer " + thisAuthHeader
Self.RequestHeader("Authorization") = hrStr
Self.RequestHeader("Content-Type") = "application/json"