Open Bug 1221703 Opened 9 years ago Updated 2 years ago

Make Firefox for iOS recognize and react to remotely deleted Firefox Account

Categories

(Firefox for iOS :: Firefox Accounts, defect)

All
iOS
defect

Tracking

()

People

(Reporter: vladikoff, Unassigned, Mentored)

Details

(Whiteboard: [lang=swift][good next bug])

## STR

1. Create an FxA Account
2. Login to Sync on FxiOS, start syncing
3. Delete account in a different browser, such as Firefox desktop.
4. Click "Sync Now" in FxiOS

## Expected

Sync should fail and user should get feedback that syncing is failing or account was deleted

## Actual

FxiOS reports "Last synced: just now"
Nick, did you have to deal with this before?
I don't think we surface this kind of failure; we definitely don't have UI to say that your account disappeared from under you!

Logs would make this bug a little more actionable, if you have them; otherwise Nick or I can grab them.
Flags: needinfo?(nalexander)
Hardware: Other → All
Summary: FxiOS still reports successful syncing even after an FxA account was deleted → Firefox for iOS reports successful syncing even after the user's Firefox Account was remotely deleted
Default logs from the simulator, right after I hit "Sync now" (with a deleted account):

```
2015-11-04 15:37:18.386 [Debug] [SyncAuthState.swift:113] token(_:canBeExpired:) > Advancing Account state.
2015-11-04 15:37:18.386 [Info] [FxALoginStateMachine.swift:57] advanceOneState(_:now:) > Advancing from state: married
2015-11-04 15:37:18.386 [Debug] [FxALoginStateMachine.swift:61] advanceOneState(_:now:) > Checking key pair freshness.
2015-11-04 15:37:18.387 [Debug] [FxALoginStateMachine.swift:66] advanceOneState(_:now:) > Checking certificate freshness.
2015-11-04 15:37:18.387 [Info] [FxALoginStateMachine.swift:71] advanceOneState(_:now:) > Key pair and certificate are fresh; staying Married.
2015-11-04 15:37:18.387 [Debug] [FirefoxAccount.swift:182] advance() > no advance() in progress; setting and returning new shared deferred.
2015-11-04 15:37:18.387 [Info] [KeychainCache.swift:52] checkpoint() > Storing account.state in Keychain with label account.state.lCz1Q5Szu-I6.
2015-11-04 15:37:18.394 [Debug] [FirefoxAccount.swift:191] advance() > advance() completed and shared deferred is existing deferred; clearing shared deferred.
2015-11-04 15:37:18.394 [Info] [SyncAuthState.swift:116] token(_:canBeExpired:) > Account is in Married state; generating assertion.
2015-11-04 15:37:18.395 [Debug] [SyncAuthState.swift:121] token(_:canBeExpired:) > Fetching token server token.
```
> Key pair and certificate are fresh; staying Married.

I guess this comes from caching the FxA certificate, it can happily keep syncing for a couple of hours before it needs to checkin again with FxA and discover that the account has been deleted, at which point it should definitely start reporting an error.
Yup. The only thing we fetch fresh each time is the token server token. If you need insta-logout, you need to tell the token server and/or implement a push-based system as part of the device manager.
> you need to tell the token server

This would reduce but maybe not eliminate the problem, since tokenserver tokens can also be cached.

> or implement a push-based system as part of the device manager

Let's do this one.  I know Nick has been doing some work on WebPush for Android, is there similar work in progress for iOS?
> Let's do this one.  I know Nick has been doing some work on WebPush for
> Android, is there similar work in progress for iOS?

Not yet. We've got GCM coming for Android; we'd need a deployed push-to-APNS bridge and an appropriate registration client for iOS, as well as all the wiring to FxA.

Fortunately users don't delete accounts often, right?
Rather than talk about push, let's break down a few things we should do to make this better.

The first is to observe account deletions instigated locally.  (I think we don't allow this yet, but some iOS v2 interface will).  This is the Firefox for iOS version of https://bugzilla.mozilla.org/show_bug.cgi?id=1139079.

The second is to make the login state machine recognize when the remote account has been deleted, and to message that the account has disappeared and clean up the device state as appropriate.  This is the equivalent of Fennec's https://bugzilla.mozilla.org/show_bug.cgi?id=999198.
Flags: needinfo?(nalexander)
(In reply to Nick Alexander :nalexander from comment #8)
> Rather than talk about push, let's break down a few things we should do to
> make this better.
> 
> The first is to observe account deletions instigated locally.  (I think we
> don't allow this yet, but some iOS v2 interface will).  This is the Firefox
> for iOS version of https://bugzilla.mozilla.org/show_bug.cgi?id=1139079.

Wait -- this *is* https://bugzilla.mozilla.org/show_bug.cgi?id=1139079.

> The second is to make the login state machine recognize when the remote
> account has been deleted, and to message that the account has disappeared
> and clean up the device state as appropriate.  This is the equivalent of
> Fennec's https://bugzilla.mozilla.org/show_bug.cgi?id=999198.

Let's mutate this ticket to be this.  I think we'd see an error with error code 102 (account does not exist); we'd then use the API at https://github.com/mozilla/fxa-auth-server/blob/master/docs/api.md#get-v1accountstatus to confirm the account is gone, and message as appropriate.
Mentor: nalexander
Summary: Firefox for iOS reports successful syncing even after the user's Firefox Account was remotely deleted → Make Firefox for iOS recognize and react to remotely deleted Firefox Account
Whiteboard: [lang=swift][good next bug]
(In reply to Ryan Feeley [:rfeeley] from comment #10)
> Related? https://github.com/mozilla/fxa-content-server/issues/3057

Yep.  I filed that ticket after witnessing this issue on Android.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.