FxaEvent
public enum FxaEvent : Equatable, Hashable
extension FxaEvent: Sendable
Fxa event
These are the events that consumers send to [crate::FxaStateMachine::process_event]
-
Initialize the state machine. This must be the first event sent.
Declaration
Swift
case initialize(deviceConfig: DeviceConfig ) -
Begin an oauth flow
If successful, the state machine will transition the [FxaState::Authenticating]. The next step is to navigate the user to the
oauth_urland let them sign and authorize the client.This event is valid for the
Disconnected,AuthIssues, andAuthenticatingstates. If the state machine is in theAuthenticatingstate, then this will forget the current OAuth flow and start a new one.Declaration
Swift
case beginOAuthFlow(service: String, scopes: [String], entrypoint: String ) -
Begin an oauth flow using a URL from a pairing code
If successful, the state machine will transition the [FxaState::Authenticating]. The next step is to navigate the user to the
oauth_urland let them sign and authorize the client.This event is valid for the
Disconnected,AuthIssues, andAuthenticatingstates. If the state machine is in theAuthenticatingstate, then this will forget the current OAuth flow and start a new one.Declaration
Swift
case beginPairingFlow(pairingUrl: String, service: String, scopes: [String], entrypoint: String ) -
Complete an OAuth flow.
Send this event after the user has navigated through the OAuth flow and has reached the redirect URI. Extract
codeandstatefrom the query parameters or web channel. If successful the state machine will transition to [FxaState::Connected].This event is valid for the
Authenticatingstate.Declaration
Swift
case completeOAuthFlow(code: String, state: String ) -
Cancel an OAuth flow.
Use this to cancel an in-progress OAuth, returning to [FxaState::Disconnected] so the process can begin again.
This event is valid for the
Authenticatingstate.Declaration
Swift
case cancelOAuthFlow -
Check the authorization status for a connected account.
Send this when issues are detected with the auth tokens for a connected account. It will double check for authentication issues with the account. If it detects them, the state machine will transition to [FxaState::AuthIssues]. From there you can start an OAuth flow again to re-connect the user.
This event is valid for the
Connectedstate.Declaration
Swift
case checkAuthorizationStatus -
An
fxaccounts:change_passwordWebChannel message arrived on the device that just changed its password.json_payloadis thedataobject of that message and contains the new session token. The state machine swaps the session token for a new refresh token and re-initialises the device record.This event is valid for the
ConnectedandAuthIssuesstates. InAuthenticatingit is a no-op so the in-progress OAuth flow is not disrupted.Declaration
Swift
case webChannelPasswordChange(jsonPayload: String ) -
Disconnect the user
Send this when the user is asking to be logged out. The state machine will transition to [FxaState::Disconnected].
This event is valid for the
Connectedstate.Declaration
Swift
case disconnect -
Force a call to [FirefoxAccount::get_profile]
This is used for testing the auth/network retry code, since it hits the network and requires and auth token.
This event is valid for the
Connectedstate.Declaration
Swift
case callGetProfile