iwonbigbro/gsync

Credentials not stored after typing the received code

Opened this issue · 2 comments

When trying to execute gsync, the library loops continuously asking to type the received code from the provided Google link, and this is caused because the credentials are not stored into $HOME/.gsync/credentials once the verification is passed.

It can be triggered by executing the following code that tries to sync a folder $HOME/temp into the Google Drive folder /temp:

mkdir -p $HOME/temp
touch $HOME/temp/hello.txt
gsync -v -c -r -p -o -g --delete $HOME/temp/ drive://temp

I patched this in a fork by adding an explicit save after obtaining credentials in Line 347 of the libgsync/drive/__init__.py file, i.e. from

        if credentials is None:
            credentials = self._obtain_credentials()

into

        if credentials is None:
            credentials = self._obtain_credentials()
            if storage is not None:
                storage.put(credentials)

and now it seems to work.

I just realised that this bug is very likely the same as issues #61 and #91.