Thank you Eric for the HTTP Request File Object.
I was able to download file using your object on REST API with Basic Authentication.
However, I had to make a small code change in your code to connect to Box Integration (Oauth 2.0).
Bearer token is only good for one hour. Need to figure it a way to generate new Bearer token using client_id and client_secrete every request.
Box provided javascript code to generate new token (Find attached) Now, I need to convert it from javascript to VB and incorporate it to Request File Object. https://developer.box.com/guides/tooling/postman/quick-start/.
Try
Dim request As WebRequest = WebRequest.Create(addressURL)
If forcePreAuth Then
'Sometimes a web server will require the authorisation header in the initial request
'In which case we have to add the basic authorization header manually.
Dim bytes() As Byte = System.Text.Encoding.UTF8.GetBytes(String.Format("{0}:{1}",username,password))
Dim base64 As String = Convert.ToBase64String(bytes)
'For Basic Authorization
'request.Headers.Add("Authorization", "Basic " & base64)
' Box doesn't support Basic Authentication.
'Have to use Oauth2, Bearer token is only good for one hour. Need to figure it a way to generate new Bearer token using client_id and client_secrete every request
request.Headers.Add("Authorization", ": Bearer *token************************************")
------------------------------
Michael Ng
------------------------------