Learn how to make the most out of the Dropbox Community here 💙!
Forum Discussion
alca
8 years agoExplorer | Level 3
Android authentication
In the previous api login could be performed to the device dropbox account by using the api key and the api secret, is there any way to do this with V2? What a I need is to be able to connect to dife...
Greg-DB
Dropbox Staff
8 years agoThe app key and secret themselves are not enough to connect to a Dropbox account, in either API v1 or API v2.
To connect to a Dropbox account via the API, you need an "access token". You can get an access token for the user by sending the user through the OAuth app authorization flow. You can find an example implementation of doing this on Android with the API v2 Java SDK here:
https://github.com/dropbox/dropbox-sdk-java/tree/master/examples/android
Specifically, the process is initiated here:
And completed here:
One difference between API v1 and API v2 is that API v2 uses OAuth 2 exclusively, where the app secret is not necessary for client-side apps, such as on Android. Only the app key is needed to start the OAuth app authorization flow and get an access token for the current user.
alca
8 years agoExplorer | Level 3
Im not sure if I´m doing this OK, but this is what I do and application crushes:
Auth.startOAuth2Authentication(this, this.RASVIET_APP_KEY_V2);
String accessToken = Auth.getOAuth2Token();
this is an activitie that
extends PreferenceActivity
and rasviet_app_key_v2 is my key for the app
- Greg-DB8 years ago
Dropbox Staff
Are you calling startOAuth2Authentication and getOAuth2Token together like that? You should use just startOAuth2Authentication to initiate the app authorization flow. You should then later call getOAuth2Token to complete the app authorization flow in onResume. (Please refer to the samples linked in my previous post.)
Otherwise, please share the full error/output you're getting.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,975 PostsLatest Activity: 3 hours ago
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!