0

I'm trying to use dropnet for file upload on Dropbox in vb, but does not work. Results the following error: Received Response [Unauthorized]: Expected to see [OK]. The HTTP response was [{"error": "Request token not found."}] Here is my code:

_client = New DropNetClient("xxxxxxx", "xxxxxxx")
   Dim login As UserLogin = _client.GetToken()
   _client.UserLogin = login
   Dim url = _client.BuildAuthorizeUrl()
   Process.Start(url)
Dim tokenAcess = _client.GetAccessToken()
        _client.GetAccessTokenAsync(Function(accessToken)
           _client = New DropNetClient("xxxxxx", "xxxxxx", tokenAcess)
           End Function, Function([error])                                                      MessageBox.Show([error].Message)

        End Function)
   Try
    Dim rawData As Byte() = File.ReadAllBytes("c:\image.png")
     Dim result As MetaData = _client.UploadFile("/", "image.png", rawData)
     MessageBox.Show("Successfully uploaded to Dropbox.", "Uploaded to Dropbox")
   Catch dropboxEx As Exception
     MessageBox.Show("Error: " + dropboxEx.Message)
  End Try
  • 1
    I'm not familiar with Dropnet, but it *looks like* you call GetAccessToken twice: once synchronously and once asynchronously. Does that make sense? Why do you do that? – Heinzi Mar 19 '15 at 15:39
  • 1
    Yea, `GetAccessToken` and `GetAccessTokenAsync` probably consume the request token DropNet retrieved and stored for you, causing the error you're getting, presumably on the second call. You probably only need to use one of these. Also, make sure you don't make that call until the user authorizes the app via the authorization page at `url`. It's not clear from this code that you're waiting for them to do so. – Greg Mar 19 '15 at 18:36

0 Answers0