Skip to content

Conversation

mymindstorm
Copy link
Member

  • Fixes issue with text not being substituted
  • Fixes issue where failure message shows up instead of auth_revoke message

@mymindstorm
Copy link
Member Author

@Sneezry is this okay to merge?

const res = JSON.parse(xhr.responseText);
if (res.error) {
if (res.error.code === 401) {
if (navigator.userAgent.indexOf('Chrome') !== -1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this line be removed?

Copy link
Member Author

@mymindstorm mymindstorm Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We have to handle Chrome Google account login differently (via chrome.identity) from Firefox because of Google API restrictions. chrome.identity isn't part of Firefox, hence the check here.

When a user revokes a token from Google's side the token is still cached in Chrome. So, if a user tries to sign in again directly after revoking a token chrome.identity.getAuthToken would notice a cached token is still available and pull it even though it was revoked. This causes the extension to show a 'Failure' message since the 'new' token is revoked already.

To reproduce with 5.2.2:

  1. login to google drive
  2. sync
  3. revoke access from https://myaccount.google.com/permissions
  4. keep syncing until the extension gets a 401
  5. close and open the extension popup (not chrome)
  6. try to login again
  7. get error
  8. goto 6

To prove it's the cache after reproducing:

  1. see error after trying to login
  2. open chrome://identity-internals/ and revoke token
  3. try to login to drive sync
  4. success

@mymindstorm mymindstorm merged commit 4688c8f into dev Jan 23, 2019
@mymindstorm mymindstorm deleted the chrome-fixes branch January 23, 2019 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants