We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
OPunktSchmidt
4 years agoExplorer | Level 3
Java SDK - No refresh token?
Hey,
i try to get the refresh token with the Java SDK (Android App).
I start authentication with this:
Auth.startOAuth2Authentication(getContext(), "abc");
And then in onResume:
@Override
public void onResume() {
super.onResume();
if (_isCloudAuthFlow) {
_isCloudAuthFlow = false;
String token = Auth.getOAuth2Token();
String refresh = Auth.getDbxCredential().getRefreshToken();
_businessLogic.getSharedPreferences().edit().putString(getString(R.string.all_settings_dropbox_authtoken), token).apply();
}
}
I get a authToken but the refresh token is always null.
Can you help?
The startOAuth2Authentication method uses the old flow, which currently gives legacy "long-lived access tokens", which don't expire by themselves. Note that starting September 30th, 2021 Dropbox will no longer return new long-lived access tokens, so you should switch to the new flow.
The startOAuth2PKCE uses the new flow, which gives "short-lived access tokens", which do expire by themselves, as well as "refresh tokens", which don't expire by themselves.
- Greg-DBDropbox Staff
You should use the startOAuth2PKCE method instead of startOAuth2Authentication now. You can find an example here:
- OPunktSchmidtExplorer | Level 3
Greg-DB wrote:You should use the startOAuth2PKCE method instead of startOAuth2Authentication now. You can find an example here:
Yes, with the startOAuth2PKCE - Method i get a refresh token. Does the authToken with startOAuth2Authentication - Method never expire?
- Greg-DBDropbox Staff
The startOAuth2Authentication method uses the old flow, which currently gives legacy "long-lived access tokens", which don't expire by themselves. Note that starting September 30th, 2021 Dropbox will no longer return new long-lived access tokens, so you should switch to the new flow.
The startOAuth2PKCE uses the new flow, which gives "short-lived access tokens", which do expire by themselves, as well as "refresh tokens", which don't expire by themselves.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 3 hours agoIf 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!