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

Forum Discussion

agomezv's avatar
agomezv
Explorer | Level 3
3 years ago

VBA & API authentication

Hi, I have a VBA  that uses the API to create  shared links (another process generates these files) , by now  I´m using the token that the AppConsole generates and everything it´s ok.

I only need to make this to files from one account ( my account) 

The token that I generate has limited time.

My question is: How can I get access the  API whitout implement the OAuth2 flow?

 

This because it will be impossible that the user gets a token from the AppConsole everytime that he use my VBA app.

 

Thanks in advance

4 Replies

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    3 years ago

    agomezv wrote:

    ...

    My question is: How can I get access the  API whitout implement the OAuth2 flow?

    ...


    Hi agomezv,

    It's impossible yet.

     


    agomezv wrote:

    ...

    This because it will be impossible that the user gets a token from the AppConsole everytime that he use my VBA app.

    ...


    The user doesn't need to go in such a way. He can authenticate your application like any other app (like the example here in Python) or authentication in advance and using credentials further, in the actual application, without any other user actions within the app itself.

    Hope this helps.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    agomezv It is not possible to get long-term access without using the OAuth app authorization flow. Apps can get long-term access by requesting "offline" access in the OAuth flow, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. Note that you only need to do this once per account though, as the resulting refresh token does not expire.

     

    You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.

     

  • agomezv's avatar
    agomezv
    Explorer | Level 3
    3 years ago

    Thanks Здравко and Greg, One more question:

    If from a browser I invoke:

       https://www.dropbox.com/oauth2/authorize?client_id=fkdw14thym0pxgz&response_type=code&token_access_type=online 
       to get an auth code, 

     

    And then, within my VBA app, use the 

     

    'curl https://api.dropbox.com/oauth2/token \
    ' -d code=<AUTHORIZATION_CODE> \
    ' -d grant_type=authorization_code \
    ' -d redirect_uri=<REDIRECT_URI> \
    ' -d client_id=<APP_KEY> \
    ' -d client_secret=<APP_SECRET>

     

    Can I get and refresh the token? Does it will work ?

     

    Thanks

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    agomezv Yes, that process would give you a refresh token that can be stored and re-used repeatedly to get new short-lived access tokens as needed.

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!