Google drive token storage

Having setup my google drive in duplicacy-web I expected that the token would be stored away somewhere and so I deleted the downloaded gcd-token.json file. However duplicacy then says it can’t connect to my google drive.

2019-08-08 17:32:18.173 ERROR STORAGE_CREATE Failed to load the Google Drive storage at gcd://Backups/PCName: open C:/Users/Phil/Downloads/gcd-token.json: The system cannot find the file specified.

When I look in the duplicacy.json file though I find this entry (modified a bit for security)

        "name": "PCName",
        "url": "gcd://Backups/PCName",
        "encrypted": true,
        "credentials": {
            "gcd_token": "dfd689..............10c45f",
            "password": "c1aee...............32dda"

So it seems like it has something stored but isn’t being used.

So should it be using the stored copy or the file?

If its supposed to use the file then is there anyway to move it so I don’t have it in my downloads folder forever?

This is applicable to both the Web GUI Edition and the CLI.

That gcd-token.json file does indeed need to be kept, and kept in exactly the place where you point it at when initialising the storage. I believe the hashed credential in the duplicacy.json is merely the pathname to that file.

If you move it, you’ll need to re-initialise the storage and, as far as I remember, the CLI should ask again where it is. But I don’t think the Web Edition lets you change it yet.

You can possibly hack the entry by adding a dummy storage, via the GUI, pointing to the same GCD, then edit duplicacy.json with a text editor, copy paste the gcd_token hash from that storage to the other, then delete the dummy in the GUI. Before which, you should manually move the gcd-token.json to a safe place. I suggest in the root of .duplicacy-web.

Alternatively, just delete the storage and re-initialise with the same name, although I don’t know what impact that will have on storage stats, jobs or schedules etc… I guess if the storage name is the same, you may not see any issues, but I just don’t know.

1 Like

Just tested it myself. My hack idea worked perfectly. :slight_smile:

Some observations…

Using .duplicacy-web as a location for gcd-token.json is doable but you’ll have to type or paste the pathname (e.g. C:\Users\Phil\.duplicacy-web\gcd-token.json) into the text field, as the file browser in the Web GUI won’t show hidden folders, which includes any that begin with a period.

You also probably want to quit Duplicacy from the icon tray before editing the duplicacy.json with a text editor.

I’m sure the Web Edition will eventually get the ability to edit this sort of stuff within the actual GUI.

2 Likes

Excellent info thanks Droolio. I’ll give that a go.

I would be good if the text on the storage setup screen for google drive could highlight the importance of the file as i’m sure others might do the same thing since its so easy with point and click.

1 Like