C
C#16mo ago
BurakD.

❔ Dropbox Refresh Access Token

When my access token expires, I need a code that will generate access tokens again, how can I do it?
3 Replies
BurakD.
BurakD.16mo ago
using (var dbx = new DropboxClient(accessToken)) { try { // Dropbox'a yüklemek istediğiniz dosya adını ve yolu belirtin string fileName = Path.GetFileName(imagePath); string dropboxPath = "/" + folderName + "/" + fileName; try { var User = dbx.Users.GetCurrentAccountAsync(); } catch (Exception ex) { MessageBox.Show( ex.Message ); } using (var stream = new FileStream(imagePath, FileMode.Open)) { // Upload the file to Dropbox FileMetadata result = await dbx.Files.UploadAsync( dropboxPath, WriteMode.Overwrite.Instance, body: stream ); // Create a shared link for the uploaded file Dropbox.Api.Sharing.SharedLinkMetadata sharedLink = await dbx.Sharing.CreateSharedLinkWithSettingsAsync(dropboxPath); // Get the URL of the shared link string sharedLinkUrl = sharedLink.Url; // Update the response model with the shared link URL dropboxResponseModel.PhotoUrl = sharedLinkUrl; dropboxResponseModel.UploadResult = true; return dropboxResponseModel; } // } catch (Exception ex) { MessageBox.Show("Dropbox İşlemleri Sırasında Bir Hata Oluştu Lütfen Ayarlarınızı Kontrol Ediniz . Hata Sebebi : "+ ex.Message+ ex.InnerException ); return null; } }
FusedQyou
FusedQyou16mo ago
Check if you're unauthorized, refresh it, and try again
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.