Not sure what happened there - I thought I'd submitted this but its disappeared - so sorry if my question is duplicated!
Anyway, I need to convert the following cURL command to vb.net to obtain an access token from an OAuth2 authorisation server. I'm normally reasonably competent handling HTTP requests in vb.net but I just can't get this to work. can anyone help please?
curl -u ID_Key:Secret_Key https://targetURL.com
My coding is:
Dim credstring As String = "ID_Key:Secret_Key"
Dim authstring As String = Convert.ToBase64String(Enc
Dim webrequest As WebRequest = webrequest.Create("https://targetURL.com?grant_type=client_credentials
n", "BASIC " & authstring)
Dim webresponse As HttpWebResponse = .GetResponse() '
Dim stream As System.IO.Stream = webresponse.GetResponseStr
Dim reader As New StreamReader(stream, Encoding.UTF8)
Dim contents As String = reader.ReadToEnd()
Obviously the ID, Key and URL will be the real thing.