Crate fxa_client
source ·Expand description
Firefox Accounts Client
The fxa-client component lets applications integrate with the Firefox Accounts identity service. The shape of a typical integration would look something like:
-
Out-of-band, register your application with the Firefox Accounts service, providing an OAuth
redirect_uri
controlled by your application and obtaining an OAuthclient_id
. -
On application startup, create a
FirefoxAccount
object to represent the signed-in state of the application.- On first startup, a new
FirefoxAccount
can be created by callingFirefoxAccount::new
and passing the application’sclient_id
. - For subsequent startups the object can be persisted using the
to_json
method and re-created by callingFirefoxAccount::from_json
.
- On first startup, a new
-
When the user wants to sign in to your application, direct them through a web-based OAuth flow using
begin_oauth_flow
orbegin_pairing_flow
; when they return to your registeredredirect_uri
, pass the resulting authorization state back tocomplete_oauth_flow
to sign them in. -
Display information about the signed-in user by using the data from
get_profile
. -
Access account-related services on behalf of the user by obtaining OAuth access tokens via
get_access_token
. -
If the user opts to sign out of the application, calling
disconnect
and then discarding any persisted account data.
Modules
Macros
Structs
Enums
FirefoxAccount
operations.