Curious about A, B, C, and D drives? Learn what they mean and how to use them effectively with Dropbox in this handy guide! - check it out now!
Forum Discussion
YousefElsayed
3 years agoExplorer | Level 3
RefreshToken is always expired android java Api
Hello , I am trying to save an Refreshtoken so I don't request from the user to login again , But every time i use the saved refreshtoken i get token expired error Start Auth Code: DbxRequestCon...
- 3 years ago
Hmm... The examples could be better structured (sometime they're even confusing).
Ok... as a walk through: You can get the credential info in the same way you have done already, but store it as whole like here (or just get the idea from there about stringification and it's not mandatory to do direct write into a file). You can see all available constructors following the link I posted in my previous post. Good choice could be this one. Different examples for destringification are spread across all examples but you can take a look here (for instance). Again, you can use any supported source of information, not mandatory direct read from a file. Possible options to read start from here and possible options to write start here. I believe you can select whatever best match your application design and stick selected together. For some Android specific solutions (authentication through eventually installed Dropbox application) take a look on the corresponding example. 😉
Hope this helps.
Здравко
3 years agoLegendary | Level 20
Hi again YousefElsayed,
I would suggest usage of more descriptive var names to avoid different types of confusion. What actually means "DROPBOX_AUTH_KEY" here (for instance)? 🧐 Is it access token or refresh token??? 🤔
According to:
YousefElsayed wrote:...
Auth.getDbxCredential().getRefreshToken();
...
It should be refresh token, but if we take a look on:
YousefElsayed wrote:...
DbxClientV2 client = new DbxClientV2(config,DROPBOX_AUTH_KEY);...
And taking into account the used constructor, it seems to be access token. 🤦🙋 Hope you understand what's wrong now. both access token and refresh token are strings, but they represent different things. From Java language point of view the construction is correct, but it's a logical error (refresh token is NOT valid access token)! You should use appropriate constructor, accepting refresh token, not something else. Or... as I mentioned before, don't cope into details, but use entire credentials object. The choice is yours. 😉 In any case/choice keep reading the documentation careful to avoid such errors.
Good luck.
YousefElsayed
3 years agoExplorer | Level 3
Sorry but can you link the correct usage of refresh token in java ? Because i am using the refresh token as access token and you're right , the documentation does not include java auth and refresh token and the github java sample got removed so i am just trying and searching for old posts on the internet
Thanks anyway
Thanks anyway
- Здравко3 years agoLegendary | Level 20
Hmm... The examples could be better structured (sometime they're even confusing).
Ok... as a walk through: You can get the credential info in the same way you have done already, but store it as whole like here (or just get the idea from there about stringification and it's not mandatory to do direct write into a file). You can see all available constructors following the link I posted in my previous post. Good choice could be this one. Different examples for destringification are spread across all examples but you can take a look here (for instance). Again, you can use any supported source of information, not mandatory direct read from a file. Possible options to read start from here and possible options to write start here. I believe you can select whatever best match your application design and stick selected together. For some Android specific solutions (authentication through eventually installed Dropbox application) take a look on the corresponding example. 😉
Hope this helps.
- YousefElsayed3 years agoExplorer | Level 3
Thanks for the help ! the links you attached are helpful !
About Discuss Dropbox Developer & API
Make connections with other developers808 PostsLatest Activity: 2 days ago
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 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!