The FxAccountsProfileClient.jsm JavaScript module provides a way to fetch Firefox Accounts profile information. The modules uses the Firefox Profiler Server API.
Components.utils.import("resource://gre/modules/FxAccountsProfileClient.jsm");
Creating a new FxAccountsProfileClient
new FxAccountsProfileClient(Object options);
Method overview
| fetchProfile(); |
Attributes
| serverURL | URL | Profiler server URL. |
token |
String | Bearer token. |
Constructor FxAccountsProfileClient()
Creates and returns a new FxAccountsProfileClient object.
FxAccountsProfileClient FxAccountsProfileClient(
Object options
String serverURL,
String token
);
Parameters
- serverURL - Firefox Profile server url.
- token - Firefox Accounts OAuth Bearer token.
Return value
A newly created FxAccountsProfileClient object implementing the methods described in this article.
Methods
fetchProfile()
Fetches Firefox Accounts profile information.
Parameters
- None
- Return value
- Promise
-
Resolves: Object - Successful response from the '/profile' endpoint.
Rejects: FxAccountsProfileClientError - Profile client error.
Examples
Using the FxAccountsProfileClient
Chrome code
let client = new FxAccountsProfileClient({
serverURL: "https://profile.accounts.firefox.com/v1",
token: "FXA_OAUTH_BEARER_TOKEN",
});
client.fetchProfile().then(profile => console.log(profile));
Error Handling
The FxAccountsProfileClient.jsm normalizes request and client errors into FxAccountsProfileClientError object.
FxAccountsProfileClientError
Attributes
| name | String | Name of the error FxAccountsProfileClientError |
code |
Number | Status code of the request |
| errno | Number | Error number |
| error | String | Error description |
| message | String | Error message |
See also
Document Tags and Contributors
Last updated by:
vladikoff,