You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Riccardo Chojwa's avatar
Riccardo Chojwa
Explorer | Level 4
4 years ago

getting Token with VBA

Hi

is there a way to get the DropBox token programmatically through VBA (or a different language, I'll try and translate it into VBA)?

this to have my VBA macro go on after that and download a file thorugh DropBox API for which I need the token for the "bearer" parameter

Thanks

Riccardo
Riccardo

  • Greg-DB's avatar
    Greg-DB
    4 years ago

    I'm not sure exactly what you were trying to build with that code, but no, you should not be attempting to programmatically access the Dropbox web site like that.

  • Riccardo Chojwa's avatar
    Riccardo Chojwa
    Explorer | Level 4

    Hi

    I'm trying to login to my DropBox account through the following code

    Dim myURL As String
    myURL = "https://www.dropbox.com/home/myFolderName"
    
    Dim WinHttpReq As Object
    Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
    WinHttpReq.Open "GET", myURL, False, myUserName, myPWD
    WinHttpReq.send

    but I'm getting a WinHttpReq.Status of 400 instead of the expected 200

    what am I doing wrong?

    thank you

    Riccardo

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    In order to get an access token (and optionally a refresh token) for an account, your app should implement the OAuth app authorization flow. You can find information on how this process works in the OAuth Guide and authorization documentation

     

    In your code snippet here, you seem to be attempting to access the Dropbox web site ("https://www.dropbox.com/home...") programmatically, which is incorrect. The Dropbox web site is only meant for use by web browsers.

     

    The OAuth app authorization flow works by having the app direct the user to the Dropbox web site's app authorization page in the user's web browser, where the user chooses whether or not to authorize the app. If the user chooses to do so, the app will then get an access token (and optionally a refresh token) that it can use to make API calls.

    • Riccardo Chojwa's avatar
      Riccardo Chojwa
      Explorer | Level 4

      Hi Greg

      thank you again for your prompt and hi-tech support

      for the Token issue, I'll look into the OAuth Guide and authorization documentation. and see what I can dig out of it

      for the Dropbox web site programatic access issue, is it incorrect/not meant for and yet feasable in some way?

      Thanks
      Riccardo

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        I'm not sure exactly what you were trying to build with that code, but no, you should not be attempting to programmatically access the Dropbox web site like that.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,908 PostsLatest Activity: 18 minutes ago
332 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!