The FxAccountsOAuthClient.jsm JavaScript module provides a way for browser services to authenticate with the Firefox Accounts OAuth server.
Components.utils.import("resource://gre/modules/FxAccountsOAuthClient.jsm");
new FxAccountsOAuthClient(Object options);
| launchWebFlow(); |
| tearDown(); |
| parameters | Object | Returns the set of parameters that initialized the Firefox Accounts OAuth flow. |
onComplete |
Function | Gets called when the Firefox Accounts OAuth flow successfully completes. First and only argument is an Object that has "state" and "code" properties. |
Creates and returns a new FxAccountsOAuthClient object.
FxAccountsOAuthClient FxAccountsOAuthClient(
Object options
Object parameters
String client_id
String state
String oauth_uri
String content_uri
[optional] String scope
[optional] String action
[optional] String authorizationEndpoint
);
parameters/authorizationA newly created FxAccountsOAuthClient object implementing the methods described in this article.
let parameters = { oauth_uri: OAUTH_SERVER_ENDPOINT, client_id: OAUTH_CLIENT_ID, content_uri: CONTENT_SERVER_URL, state: OAUTH_STATE } let client = new FxAccountsOAuthClient({ parameters: parameters }); client.onComplete = function (tokenData) { // tokenData consists of two properties: "tokenData.state" and "tokenData.code" }; client.launchWebFlow();