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

Forum Discussion

novotny's avatar
novotny
Explorer | Level 4
4 years ago

backend Java process to read a shared folder

Hi,

 

We need a java workflow to scan the contents of a shared folder on a daily basis. I have downloaded the examples and looked at AuthorizeExample which I ran with the parameters "test.app test.auth short_live_token". This code appears to requires clicking a dropbox link

 

https://www.dropbox.com/oauth2/authorize?token_access_type=offline&response_type=code&client_id=XXXXX

 

to get an authorization code which is then used to generate a token and then the token can be used to list files in a folder. How can this all be done on the backend without human intervention? Are there any examples I can look at? With AWS S3 it's easily done with an access key and a secret key, I was hoping it would be similar.

 

Thanks, Jason

14 Replies

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

    novotny Yes, the expiration is only about the access token. The refresh token doesn't expire (though can be revoked on demand). If the expiration has passed, the client will use the refresh token to get a new access token automatically.

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

    Something more: don't try change 'expireAt'. Your code will fail!!! There are ways to optimize your code but you need to keep entire credentials object and serialize and deserialize it. Don't change anything by hands there.

  • novotny's avatar
    novotny
    Explorer | Level 4
    4 years ago

    Ok so just to confirm even if the hardcoded credential I pass in to create DBTeamClientV2 has expired already (i.e. I run this code next week), it will simply use the refresh token to obtain a new one and everything should work.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with 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!