WorldBrain / Memex

Browser extension to curate, annotate, and discuss the most valuable content and ideas on the web. As individuals, teams and communities.
https://worldbrain.io
4.38k stars 335 forks source link

Backups feature unusable after removing "Memex Cloud" from GDrive settings #747

Open poltak opened 5 years ago

poltak commented 5 years ago

If reporting a bug:

  1. Can you describe the problem and bug in more detail? After recent fixes in the backup feature, I wanted to redo my DB backup from scratch.

For whatever reason, I thought the best way to do this might be to go into Google Drive -> Settings -> Manage Apps and delete data and disconnect the Memex Cloud app, then go back into the ext and start again.

Though going back to the extension it still thought it was connected to Google Drive, and would not let me redo my backup. I also manually cleared all the local storage stuff relating to backups, manually removed the backupChanges DB table data, however I've obviously done something wrong as now I can use the UI as usual but the prep stage only schedules a small number of changes each time (going by the BG script console output)

  1. How can we replicate the issue?

I'll put something here later.

  1. Expected behavior (i.e. solution)

It handles the fact that it no longer has access to Google Drive.

  1. Error stack (from extension crash page)

N/A

  1. Other comments

I'll have a play with this when I have time. I'm sure there's some fairly simple way around this to allow me to get back to being able to use the feature.

It would be good to learn more about what happened though, so we can handle the case where anyone else tries to be super smart and delete + disconnect their Drive from memex, like me.

digi0ps commented 5 years ago

It would be good to learn more about what happened though, so we can handle the case where anyone else tries to be super smart and delete + disconnect their Drive from memex, like me.

What I think must have happened is that the isAuthenticated state must have been true but trying to access Google Drive would have failed.

There seems to be this method DriveTokenManager.refreshAccessToken which gets a new token if the previous token has expired. This method is called right before fetching the objects list. But it doesn't seem to change the isAuthenticated state. So I guess, having a method which checks the validity of the stored token before the user selects the backup provider would fix this!

What do you think @ShishKabab?