I'm updating my code to use dropbox-core-sdk-3.1.5 instead of dropbox-core-sdk-3.1.1.
I've updated my app permission to use the short-lived access token in the Dropbox Console.
When a user login into my app, she can connect her dropbox account, and the dropbox content is downloaded and shown.
But after 4h, she must reconnect the dropbox account since token is expired.
How can I avoid this?
My calls are
// V2 api /oauth2/authorize
DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder()
.withRedirectUri(redirectUri, sessionStore)
.withTokenAccessType(TokenAccessType.OFFLINE)
.build();
DbxWebAuth webAuth = new DbxWebAuth(reqConfig, appInfo);
then
// V2 api /oauth2/token
DbxWebAuth webAuth = new DbxWebAuth(reqConfig, appInfo);
authFinish = webAuth.finishFromRedirect(
redirectUri, sessionStore, params);
And I use this authFinish to call the get the current account
// V2 api /2/users/get_current_account
DbxClientV2 dbxClient = new DbxClientV2(reqConfig, accessToken);
FullAccount fullAccount = dbxClient.users().getCurrentAccount();
return fullAccount;
Then I store the access token
AuthorizationToken token = new AuthorizationToken();
token.setExternalUserId(authFinish.getUserId());
token.setToken(authFinish.getAccessToken());
Should I use the refresh_token instead of the access token?
Should I check the expires time, and recall the /oauth2/token specifying grant_type=refresh_token ?