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() → {Promise}

Gets the access token from the starling OAuth endpoint

Source:
Parameters:
Name Type Description
parameters.apiUrl string

the OAuth url

parameters.queryParams 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