We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

qazimuneeb1's avatar
qazimuneeb1
Explorer | Level 3
5 years ago

Access my different dropbox accounts

Hi. I have different dropbox accounts for my files for some reason. I want to develop an android application which use dropbox authflow and i put my credentials for specific account and get the files placed in it and shows on my android app. After that i logout and then i login from another dropbox account and get the files from that account in my android app. Means that my android app will only handle one dropbox account at a time. I want to know is that possible to use a single android app and use different dropbox accounts using that app?

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

    You do not need to get a different app key for each account. As the developer, you only need to register your app once, at which point you'll receive an app key for the app. The app key only identifies the app, and does not enable access to any particular account. You can use the one app key in your app to allow multiple different accounts to connect to your app. Once the user authorizes the app with the OAuth app authorization flow, the app will receive an access token for that account. If done for multiple accounts, the app will receive a distinct access token per account.

    And yes, if you have more than one app installed using the same app key you will get that security alert. The solution is just to uninstall one of the apps so that you just have only one copy of the app installed with the app key.

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

    It is possible to use one app to connect to multiple different Dropbox accounts. 

    For developing an Android app that uses the Dropbox API, we recommend using the official Dropbox Java SDK:

    https://github.com/dropbox/dropbox-sdk-java

    There's an example Android app here:

    https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android

    You should not embed any account credentials (username/password) in the app though. In order to connect to an account, the app should send the user through the OAuth app authorization flow. If the user authorizes the app, the app receives an access token for that account. The app can do this for each user to get an access token for each account. The example app above contains an example implementation of the app authorization flow. You can store and re-use more than one access token in a single app.

    • qazimuneeb1's avatar
      qazimuneeb1
      Explorer | Level 3

      Thanks alot Greg. I am going to build the app. :)

      • qazimuneeb1's avatar
        qazimuneeb1
        Explorer | Level 3

        One more thing that i built an app using the above examples, i was asked to put my app key inside manifest file and then i have to provide the app key on the login button aswell i.e

        Auth.startOAuth2Authentication(getApplicationContext(), getString(R.string.APP_KEY));

        i was confused which app key i should hardcode in my app because each dropbox account has its own app key. Providing different app key and connecting to different dropbox account is confusing to me. I had done this before and it works well in the start but after some attempts i got a secuirty alert box that some app is posing like your app hence your linking is disabled. This might be done because i placed same code and credentials in other app i.e the final apk. In simple words, i had two apks with same code and app keys in my phone and when i started to login from my 2nd app then this alert comes and i was unable to connect to dropbox account afterwards using the app. 

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

795 PostsLatest Activity: 7 days ago
192 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!