Skip to content

Latest commit

 

History

History
66 lines (52 loc) · 3.89 KB

README.md

File metadata and controls

66 lines (52 loc) · 3.89 KB

Firefox Accounts Scoped Key Relier Documentation

Also see Deriver and Private method documentation.

OAuth methods to authenticate with Firefox Accounts and get scoped keys

Example

const fxaKeysUtil = new fxaCryptoRelier.OAuthUtils();

fxaKeysUtil.launchWebExtensionKeyFlow('YOUR_CLIENT_ID', {
  redirectUri: browser.identity.getRedirectURL(),
  scopes: ['profile', 'https://identity.mozilla.com/apps/lockbox'],
}).then((loginDetails) => {
  const key = loginDetails.keys['https://identity.mozilla.com/apps/lockbox'];
  const credentials = {
    access_token: loginDetails.access_token,
    refresh_token: loginDetails.refresh_token,
    key
};

relier-OAuthUtils~launchWebExtensionFlow(clientId, [options]) ⇒ Promise

Used to launch the Firefox Accounts login flow in WebExtensions. Does not fetch scoped keys.

Kind: inner method of relier-OAuthUtils

Param Type Default Description
clientId string FxA relier client id
[options] object {}
[options.action] string "'email'" Specifies the behavior of users sent to /. Valid values are: email, signin, signup
[options.redirectUri] URI '' URI to redirect to when flow completes
[options.deviceId] string A valid deviceId for metrics, should be paired with flowId and flowBeginTime
[options.flowId] string A valid flowId for metrics, should be paired with deviceId and flowBeginTime
[options.flowBeginTime] num A valid flowBeginTime for metrics, should be paired with deviceId and flowId
[options.scopes] array [] Requested OAuth scopes
[options.browserApi] object browser Custom browser API override
[options.ensureOpenIDConfiguration] function ensureOpenIDConfiguration Custom ensureOpenIDConfiguration function override
[options.getBearerTokenRequest] function getBearerTokenRequest Custom getBearerTokenRequest function override

relier-OAuthUtils~launchWebExtensionKeyFlow(clientId, [options]) ⇒ Promise

Used to launch the Firefox Accounts scope key login flow in WebExtensions

Kind: inner method of relier-OAuthUtils

Param Type Default Description
clientId string FxA relier client id
[options] object {}
[options.action] string "'email'" Specifies the behavior of users sent to /. Valid values are: email, signin, signup
[options.redirectUri] URI '' URI to redirect to when flow completes
[options.scopes] array [] Requested OAuth scopes
[options.browserApi] object browser Custom browser API override
[options.ensureOpenIDConfiguration] function ensureOpenIDConfiguration Custom ensureOpenIDConfiguration function override
[options.getBearerTokenRequest] function getBearerTokenRequest Custom getBearerTokenRequest function override