Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I would like to be able to check if Dropbox authentication was successful.
In the old API v1, it was possible to run the following code:
AndroidAuthSession session = dropboxApi.getSession();
if (session.authenticationSuccessful()) {
try {
// Mandatory call to complete the auth
session.finishAuthentication();
storeAuth(session);
} catch (IllegalStateException e) {
cs = "Could not authenticate with Dropbox:" + e.getLocalizedMessage();
...
}
}
What would be the equivalent method in API v2 when running the following code:
Auth.startOAuth2Authentication(this, APP_KEY);
Also, is it possible to check if the following call was successful:
DropboxClientFactory.init(accessToken);
Using the API v2 Java SDK on Android, you can check if the app authorization was approved and get the access token using getOAuth2Token as shown here. It will return null if not.
The DropboxClientFactory.init method just builds a local client object, using whatever access token you give it, so you don't need to check for success. You can see it used here.
If you want to check that your access token is still valid, you need to make any actual API call, such as getCurrentAccount.
-
-
-
- ![]()
Did this post help you? If so please mark it for some Kudos below.
Did this post fix your issue/answer your question? If so please press the 'Accept as Solution' button to help others find it.
Did this post not resolve your issue? If so please give us some more information so we can try and help - please remember we cannot see over your shoulder so be as descriptive as possible!
Using the API v2 Java SDK on Android, you can check if the app authorization was approved and get the access token using getOAuth2Token as shown here. It will return null if not.
The DropboxClientFactory.init method just builds a local client object, using whatever access token you give it, so you don't need to check for success. You can see it used here.
If you want to check that your access token is still valid, you need to make any actual API call, such as getCurrentAccount.
Thank you Greg for the clarification. I was already doing that in code, as suggested, but I thought there was possibly another way to immediately check authentication.
Hi there!
If you need more help you can view your support options (expected response time for a 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!