This seems to be a continuation of several issues I have posted questions about. I have an application that queries an eBay api for a user token when posting a refresh token. I created a test application in VB.Net where I supply the user refresh token to a form, the test app then runs a VB.NET routine which references RestSharp. The Client is created when the form opens in the test app and when the class is instanciated in the final app. This is to reuse the client for the remaining calls once I have a user token. Code below.
Dim client As RestClient = New RestClient(sBaseURL)
Async Sub cmdGetCode_Click(sender As Object, e As EventArgs) Handles cmdGetCode.Click
Dim Base64Auth As String = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(ClientID & ":" & ClientSec))
Dim request As RestRequest = New RestRequest(sTokURL, Method.Post)
With request
.AddHeader("Content-Type", "application/x-www-form-urlencoded")
.AddHeader("Authorization", "Basic " & Base64Auth)
.AddParameter("grant_type", "refresh_token")
.AddParameter("refresh_token", txtRefreshToken.Text)
.AddParameter("Scope", "https://api.ebay.com/oauth/api_scope/sell.inventory")
End With
Try
Dim response = Await client.PostAsync(request)
'Dim responce = Await client.ExecuteAsync(request)
If response.StatusCode = HttpStatusCode.OK Then
Dim sR As String = response.Content
'uT = JsonSerializer.Deserialize(Of userToken)(sR)
uT = New userToken
JsonConvert.PopulateObject(sR, uT)
txtAuthToken.Text = uT.access_token.ToString
txtDuration.Text = uT.expires_in.ToString
Else
txtRefreshToken.Text = "Failed to GetType tokens"
End If
Catch ex As Exception
txtRefreshToken.Text = "Failed to GetType tokens"
End Try
End Sub
This works. I monitor with Fiddler and it connects with api.ebay.com and establishes a tunnel to communicate over.
I use the same routine in the final application but it does not establish the communication tunnel when monitored using Fiddler. The only difference I can see from the Fiddler connection session properties is the failing one does not appear to be using TLS 1.2. The successful call has FLAGS
== FLAGS ==================
BitFlags: [ResponseGeneratedByFiddler, IsDecryptingTunnel] 0x2100
HTTPS-CLIENT-SESSIONID: empty
HTTPS-CLIENT-SNIHOSTNAME: api.ebay.com
HTTPS-CLIENT-VERSION: Tls12
HTTPS-SERVER-CIPHER: Aes128 128bits
HTTPS-SERVER-VERSION: Tls12
X-CLIENTIP: 127.0.0.1
X-CLIENTPORT: 50237
X-EGRESSPORT: 50238
X-HOSTIP: 209.140.129.40
X-PROCESSINFO: testrestsharp:21184
X-RESPONSEBODYTRANSFERLENGTH: 0
The unsuccessful call returns flags
== FLAGS ==================
BitFlags: [ResponseGeneratedByFiddler] 0x100
X-CLIENTIP: 127.0.0.1
X-CLIENTPORT: 50298
X-EGRESSPORT: 50302
X-HOSTIP: 209.140.129.40
X-PROCESSINFO: getpolicies:24828
X-RESPONSEBODYTRANSFERLENGTH: 0
I am at a loss. Both applications are using the same eBay url and the same input variables. Any thoughts on what is going on would be appreciated. Both of these applications are being run on the same computer.