API Docs for: 0.0.8
Show:

TokenAPI Class

Constructor

TokenAPI

(
  • clientId
  • [options={}]
)

Parameters:

  • clientId String
    • the OAuth client ID for the relier
  • [options={}] Object optional
    • configuration
    • [clientSecret] String optional

      Client secret

    • [oauthHost] String optional

      Firefox Accounts OAuth Server host

Item Index

Methods

destroyToken

(
  • token OAuth
  • [options={}]
)
Promise

After a client is done using a token, the responsible thing to do is to destroy the token afterwards. See https://github.com/mozilla/fxa-oauth-server/blob/master/docs/api.md#post-v1destroy

Parameters:

  • token OAuth String

    token to verify

  • [options={}] Object optional
    • configuration
    • [xhr] String optional

      XMLHttpRequest compatible object to use to make the request.

Returns:

Promise:

Response resolves to an empty object.

tradeCode

(
  • code OAuth
  • [options={}]
)
Promise

Trade an OAuth code for a longer lived OAuth token. See https://github.com/mozilla/fxa-oauth-server/blob/master/docs/api.md#post-v1token

Parameters:

  • code OAuth String

    code

  • [options={}] Object optional
    • configuration
    • [xhr] String optional

      XMLHttpRequest compatible object to use to make the request.

Returns:

Promise:

Response resolves to an object with access_token, scope, and token_type.

verifyToken

(
  • token OAuth
  • [options={}]
)
Promise

Parameters:

  • token OAuth String

    token to verify

  • [options={}] Object optional
    • configuration
    • [xhr] String optional

      XMLHttpRequest compatible object to use to make the request.

Returns:

Promise:

Response resolves to an object with user, client_id, and scopes.