We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
didouchk
3 years agoExplorer | Level 3
Why Auth.getDbxCredential method returns null after PKCE authentication (Dropbox Android JDK) ?
Hi,
I'm trying to use the new authentication flow with short-live tokens and refresh tokens on an Android App with Dropbox JDK.
I'm using the
Auth.startOAuth2PKCE()
method which works correctly, but when I tried to access the credentials in the onResume method,
DbxCredential credential = Auth.getDbxCredential();
credential.getRefreshToken(); // NullPointerException
I get a NullPointer exception.
I'd like to access and save the refresh token to the shared prefs and resuse it to prevent the user to be logged out every 4 hours.
Why the getDbxCredential() returns null ?
Thanks for your help.
didouchk In addition to what Здравко said, note that there is an Android-specific example here. Make sure you're implementing the authorization flow as shown.
And if something doesn't seem to be working as expected, please reply with:
- the version numbers of the Android platform and Dropbox SDK you are using
- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
- the full text of any error or unexpected output
- ЗдравкоLegendary | Level 20
Hi didouchk,
The description of your issue is not very "rich". Missing details on how you have done everything! The devil is in details. 😁
There is an authorization example for Java SDK. PKCE implementation could be seen in corresponding class. Take a look there and you can figure out what's missing in your code, I believe. 😉
Hope this helps.
didouchk wrote:..., but when I tried to access the credentials in the onResume method, ...
You are trying in onResume method, but is it as a result of real resume action (i.e. on authentication end)? 🤔 ... or ...?
- Greg-DBDropbox Staff
didouchk In addition to what Здравко said, note that there is an Android-specific example here. Make sure you're implementing the authorization flow as shown.
And if something doesn't seem to be working as expected, please reply with:
- the version numbers of the Android platform and Dropbox SDK you are using
- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
- the full text of any error or unexpected output
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 7 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!