Skip to content

Commit

Permalink
Use long-lived refresh token for the Dropbox backend
Browse files Browse the repository at this point in the history
The refresh token can be downloaded from https://duplicacy.com/dropbox_start
  • Loading branch information
gilbertchen committed Aug 13, 2022
1 parent 54952ce commit cde660e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/duplicacy_dropboxstorage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ type DropboxStorage struct {
}

// CreateDropboxStorage creates a dropbox storage object.
func CreateDropboxStorage(accessToken string, storageDir string, minimumNesting int, threads int) (storage *DropboxStorage, err error) {
func CreateDropboxStorage(refreshToken string, storageDir string, minimumNesting int, threads int) (storage *DropboxStorage, err error) {

var clients []*dropbox.Files
for i := 0; i < threads; i++ {
client := dropbox.NewFiles(dropbox.NewConfig(accessToken))
client := dropbox.NewFiles(dropbox.NewConfig("", refreshToken, "https://duplicacy.com/dropbox_refresh"))
clients = append(clients, client)
}

Expand Down
2 changes: 1 addition & 1 deletion src/duplicacy_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func CreateStorage(preference Preference, resetPassword bool, threads int) (stor

} else if matched[1] == "dropbox" {
storageDir := matched[3] + matched[5]
token := GetPassword(preference, "dropbox_token", "Enter Dropbox access token:", true, resetPassword)
token := GetPassword(preference, "dropbox_token", "Enter Dropbox refresh token:", true, resetPassword)
dropboxStorage, err := CreateDropboxStorage(token, storageDir, 1, threads)
if err != nil {
LOG_ERROR("STORAGE_CREATE", "Failed to load the dropbox storage: %v", err)
Expand Down

2 comments on commit cde660e

@gilbertchen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Duplicacy Forum. There might be relevant details there:

https://forum.duplicacy.com/t/dropbox-token-expiring-and-not-being-refreshed/6426/7

@gilbertchen
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Duplicacy Forum. There might be relevant details there:

https://forum.duplicacy.com/t/dropbox-backend-is-completely-non-functional/7165/4

Please sign in to comment.