cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Access my different dropbox accounts

Access my different dropbox accounts

qazimuneeb1
Explorer | Level 3
Go to solution

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?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

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
Explorer | Level 3
Go to solution

Thanks alot Greg. I am going to build the app. 🙂

qazimuneeb1
Explorer | Level 3
Go to solution

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. 

Greg-DB
Dropbox Staff
Go to solution

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.

qazimuneeb1
Explorer | Level 3
Go to solution

Thanks Greg. You tell exactly the same which i was confusing. Now its all clear to me. Thanks Again! 🙂

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    qazimuneeb1 Explorer | Level 3
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?