OAuth

OAuth

Service to interact with a the oauth endpoint

Constructor

new OAuth(options)

Create a new oauth service

Source:
Parameters:
Name Type Description
options Object

configuration parameters

Methods

getAccessToken(authorizationCode) → {Promise}

Exchanges the authorization code for an access token

Source:
Parameters:
Name Type Description
authorizationCode string

the authorization code, acquired from the user agent after the user authenticates with starling

Returns:
Type:
Promise
  • the http request promise

getOAuthToken(params) → {Promise}

Gets the access token from the starling oauth endpoint

Source:
Parameters:
Name Type Description
params object

the query params passed to the oauth endpoint as per the oauth spec

Returns:
Type:
Promise
  • the http request promise

refreshAccessToken(refreshToken) → {Promise}

Exchanges the authorization code for an access token

Source:
Parameters:
Name Type Description
refreshToken string

the oauth refresh token, used when the access token expires to claim a new access token.

Returns:
Type:
Promise
  • the http request promise