Closed Bug 1156405 Opened 10 years ago Closed 10 years ago

Cache and use expired Token Server tokens when querying info/collections

Categories

(Firefox for iOS :: Firefox Accounts, defect)

All
iOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: nalexander, Assigned: nalexander)

References

Details

Attachments

(1 file)

Right now, Sync on Firefox iOS requests a fresh token server token every sync. This is strictly not necessary: to reduce authentication requests, we can use a cached-but-expired token to make an info/collections request. (Subsequent requests, if required, need a valid token.) This ticket tracks caching and using an expired token as required.
rnewman: my plan for this is to surface the SyncAuthState directly to the Sync machine. The Sync auth state will expose an expired token on request, and also a valid token. The Account state machine will be advanced as necessary for both tokens. This inversion of control should allow an efficient authentication flow.
I *think* the Sync side of this is done; it requests an expired or not token: public class func getInfoCollections(authState: SyncAuthState, prefs: Prefs) -> Deferred<Result<InfoCollections>> { log.debug("Fetching info/collections in state machine.") let token = authState.token(NSDate.now(), canBeExpired: true) versus public class func toReady(authState: SyncAuthState, prefs: Prefs) -> ReadyDeferred { let token = authState.token(NSDate.now(), canBeExpired: false) Indeed, we're already mostly ready to take a TokenSource when advancing, which is the next step when we think we do need to sync: see advanceWithToken in InitialWithExpiredTokenAndInfo.
rnewman: I see one comment, which I'm happy to address. Add others as needed. I expect to morph remoteTimestamp into a local clock skew to have (more) accurate expired testing in a follow-up commit.
Assignee: nobody → nalexander
Status: NEW → ASSIGNED
Attachment #8595030 - Flags: review?
Attachment #8595030 - Flags: review? → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: