Forum Discussion

corvettemina's avatar
corvettemina
Explorer | Level 3
4 years ago

Get oAuth token JAVA SDk

Can anyone please show me how to get a long live access token or how to use a refresh token in the java sdk. I need it to automatically happen as i am making automations. 

 

Please

4 Replies

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

    Hi corvettemina,

    Fully automatic authentication has never been and likely  will never be. Particular user that gives right to your application to do something on his account, needs to confirm it somehow (such thing can't be fully automatic - or I don't know for such, at least). About "long live access token"; if you have some exist, you can still use it as... always. If you mean to get a new one, it's impossible already. Such tokens, even usable still, are  considered obsolete and likely will be dropped at some future point. You can see "how to use a refresh token in the java sdk" in some of the examples there (here, for instance, to receive one and here for usage in action).

    Hope this helps.

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

    corvettemina As Здравко said, the user needs to authorize the app, at least once. For long-term access, you should now be using refresh tokens. The Java SDK can actually handle the refresh process for you automatically, as long as you supply the necessary credentials, e.g., as shown retrieved in this example (meant for server-side Java apps), or this example (meant for client-side Java apps), and then used as shown in this example. (For Android, see this example instead.)

  • corvettemina's avatar
    corvettemina
    Explorer | Level 3
    4 years ago

    Awesome I've used these before maybe i am missing something after I authorized once who do i continue using it with out having to be prompted?

     

    Thanks!

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

    corvettemina, if you have used the same before, do it in the same way and only difference should be different type of token (access token before, refresh token now). That's it. If your code prompts again (without actual need), seems you have changed something in your application (something that didn't need to be changed) or you have some logical error there. Debug your code. 😉 Your code initiates the authorization, Java SDK just performs it.

    Hope this gives direction.

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!