Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

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

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
    5 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.

4 Replies

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

    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 Community Moderator rankDropbox Community Moderator
    5 years ago

    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
    5 years ago

    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 Community Moderator rankDropbox Community Moderator
    5 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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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, Facebook or Instagram.

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!