Although I’m not a Visual Basic expert, the code you’ve posted looks
You don’t explicitly set an “Accept” header there. Unless your WebRequest
component adds it automatically, you could try setting it to
The comment “Retrieve the Access Token” is worrying - to call the company
resource you need to have already exchanged the authorization token for an
access token (see
https://dev.freeagent.com/docs/oauth#the-access-token-request). Have you
already done this, or is your something other than an access token
(in which case you would expect a 401 unauthorized response).
If that doesn’t help, could you let me have the content of the response
returned by the server as that might throw some light on things. Also the
specific HTTP status code would be useful (you mentioned a "bad request -
is that an actual 400, or just a description of the problem?).
Also, you could change the endpoint to http://httpbin.org/get to see
exactly what your component is sending.
Paul.On Wednesday, 26 November 2014 10:24:05 UTC, Robert Tunna wrote:
Been having a nightmare with this authentication in a desktop application.
Finally decided to implement just the 2nd part of the authentication using
the token only, I thought this would be more straight forward, but
Dim request As HttpWebRequest = WebRequest.Create("
request.Headers.Add(“Authorization”, "OAuth ")
request.Method = “GET”
request.ContentType = “application/json”
' Send Request & Get Response
Dim response = request.GetResponse()
' Get the Response Stream
Dim reader As StreamReader = New
Dim json As String = reader.ReadToEnd()
' Retrieve the Access Token
Dim x As Dictionary(Of String, Object) =
Dim accessToken As String = x(“access_token”).ToString()
Should I not just get a json response instead of a bad request or am I
missing something here?
This does work on google playground fine and seems to have the same method
and token etc