Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Ghost Mjrm
3 years agoExplorer | Level 4
How can i get lifetime Access Token
i have android app connected to my Dropbox folder using access token but every 4 hour should i edit my code and input the new access token is there any method to make the app working 24h without any interact from me
and fix the message that show access token error uploading to Dropbox: expired access token
private void uploadToDropbox(File photoFile) {
if (photoFile == null || !photoFile.exists()) {
runOnUiThread(() -> Toast.makeText(MainActivity.this, "Error: Photo file does not exist", Toast.LENGTH_SHORT).show());
return;
}
DbxRequestConfig config = DbxRequestConfig.newBuilder("Decamera").build();
DbxClientV2 client = new DbxClientV2(config, DROPBOX_ACCESS_TOKEN);
try {
String remotePath = "/Decamera/" + photoFile.getName();
try (InputStream in = new FileInputStream(photoFile)) {
client.files().uploadBuilder(remotePath)
.withMode(WriteMode.ADD)
.uploadAndFinish(in);
runOnUiThread(() -> Toast.makeText(MainActivity.this, "Photo uploaded to Dropbox", Toast.LENGTH_SHORT).show());
}
} catch (Exception e) {
e.printStackTrace();
runOnUiThread(() -> Toast.makeText(MainActivity.this, "Error uploading to Dropbox: " + e.getMessage(), Toast.LENGTH_SHORT).show());
}
}
private static final String DROPBOX_ACCESS_TOKEN = my access token
Ghost Mjrm, Be more careful when inspecting the code.
Ghost Mjrm wrote:
... there is no offline ...Hm..🤔 Let's see where the OAuth starts here and what actually gets executed here. 🧐 Are you still thinking "there is no offline"? 🙂
Ghost Mjrm wrote:
... or refresh token exampleLet's see where OAuth finish here and what actually it executes here. Ahhh... where was this refresh token... 😉
Keep more attention on code reading.
41 Replies
Replies have been turned off for this discussion
- Здравко2 years agoLegendary | Level 20
No, 'offline' access type just adds refresh token to response, nothing else! Something that you're ignoring in your code completely so far. So that cannot be a reason. Are you sure you have uploaded to the same account? 🙃
- Ghost Mjrm2 years agoExplorer | Level 4Yeah im sure but its possible that the obtained access token belong to another person ? Not me
- Здравко2 years agoLegendary | Level 20
In other words, you're not sure - make it sure! 😉
- Ghost Mjrm2 years agoExplorer | Level 4I have recheck that the app key app secret belong to me it cannot be to another one but i think the authorisation had a configuration problem what do you think
- Здравко2 years agoLegendary | Level 20
I think you should NOT mess the application ownership with the account one! They are different things in general (can coincide of course), but you assume they are the same thing always - something wrong. I'm pretty sure your account is different (my questions above are rhetoric). 😉
- Ghost Mjrm2 years agoExplorer | Level 4
i did not understand what you mean but you make me remember about the account by mention you the account word up there
so i opened the app and instead of using a new account in the app ive used the one that belong to me the original one
but in this case when someone used my app should sign in also in my account when press on the oauth 2 operation to obtain new access token
- Здравко2 years agoLegendary | Level 20
😁 In this case (following your words) when someone uses your application should sign in in the same account when pass on the OAuth 2 operation where will look for the file uploaded (no in other account, like you did). 😉
- Ghost Mjrm2 years agoExplorer | Level 4I thought that the user can use any email to upload the file to my dropbox server app because simply using my app key and app secret that I configured in my code
- Здравко2 years agoLegendary | Level 20
Yes, user can do it and the file will get to the account matching this email (whoever is the owner). The same like when you use the official Dropbox application. Where a file put in Dropbox folder goes? 🧐 To your Dropbox account or to account own by some of the application' developers (i.e. Dropbox staff)? 🤔😄
- Ghost Mjrm2 years agoExplorer | Level 4
i understand you but where is the point of my app key and app secret in my code if the photo uploaded goes to the user dropbox account not my dropbox account
did you understand me the photo goes to the dropbox account that the user signed with it
during the oauth 2 process
you know in the authorized request it request from the user to sign in in dropbox 'in the browser'
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!