Glagan / SyncDex

Automatically sync what you read on MangaDex across many services like MyAnimeList, Anilist, Kitsu and more.
Mozilla Public License 2.0
46 stars 0 forks source link

[BUG] Google Drive refreshing tokens doesn't work #5

Closed cpiber closed 3 years ago

cpiber commented 3 years ago

Describe the bug Only says 'refreshing tokens' in logs.

Browser Firefox o84.0

Options and logs

Refreshing Google Drive token (expired 1608890066543)

Additional context Also, I noticed one of two problems (not sure which it is, haven't tested enough): Either SyncDex does not automatically upload to drive or logging into drive on a new device overwrites save data on drive. I think it should be the former, because I have some data (luckily only a day gone).

Glagan commented 3 years ago

Hum, I had problems on how to sync with Google Drive and to be always "right", and I'm not sure if what I did is good.

Basically there is only one value to check if the save is synced, there is a lastSync timestamp, and it's the return value from the server with the last modified, it's the only value checked.
If it's lower, save is uploaded, if it's higher, save is downloaded, and a save is manually triggered after you update your local save.

When you login on a new device if it doesn't have a lastSync it should download, and if you already have one it should compare and find it's lower and donwload.
If it uploaded a save it might mean that the old one didn't upload.

To avoid sending a lot of requests I set a timer of 1min after the local save is updated and it will upload it, you can see the icon if you keep it in your bar, it will be like that image

I can't intercept when you close your browser to force save, so if you closed it before it uploaded your save nothing was done.

It also might be bugged, Google Drive is being really annoying and the Application isn't even validated yet.

For the actual issue and the log, the message is logged before refreshing the token but nothing is logged when it's received, so it's normal to only see this one.

cpiber commented 3 years ago

But not three times in a row and with no sync happening ;) (I clicked on import three times, always got that message and no import I think)

It should have synced, since what was lost is at least one day (about 30 titles). I'm currently not home, when I get back I'll try to experiment a little and look at the network requests to find out more.

Glagan commented 3 years ago

I'll add a log if the token is actually received, but I see there was a lot of error in your logs from the other issue, it might have failed 3 times in a row ^^'
Maybe Google Drive is limiting the requests or something but I don't see any errors in the API Console logs.

Glagan commented 3 years ago

There was in error in the backend that refresh tokens for Google Drive, it's fixed and no updates should be required.

It's probably why you lost a day, token expired and wouldn't refresh and your save was never saved.