iwonbigbro / gsync

RSync for Google Drive - GSync
Other
238 stars 50 forks source link

Credentials not stored after typing the received code #108

Open molinav opened 4 years ago

molinav commented 4 years ago

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
molinav commented 4 years ago

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.

molinav commented 4 years ago

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