Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
didouchk
4 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
4 Replies
- Здравко4 years agoLegendary | 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-DB4 years ago
Dropbox Community Moderator
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
- PIXIP3 years agoExplorer | Level 4
I'm just pointing out that ALL the links here are broken since the repository changed on GitHub
- Greg-DB3 years ago
Dropbox Community Moderator
PIXIP Thanks for the note. I've updated the links in my post.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!