Constructor
new OAuth(options)
Create a new oauth service
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | configuration parameters |
Methods
getAccessToken(authorizationCode) → {Promise}
Exchanges the authorization code for an access token
Parameters:
Name | Type | Description |
---|---|---|
authorizationCode |
string | the authorization code, acquired from the user agent after the user authenticates with starling |
Returns:
- the http request promise
- Type
- Promise
getOAuthToken(params) → {Promise}
Gets the access token from the starling oauth endpoint
Parameters:
Name | Type | Description |
---|---|---|
params |
object | the query params passed to the oauth endpoint as per the oauth spec |
Returns:
- the http request promise
- Type
- Promise
refreshAccessToken(refreshToken) → {Promise}
Exchanges the authorization code for an access token
Parameters:
Name | Type | Description |
---|---|---|
refreshToken |
string | the oauth refresh token, used when the access token expires to claim a new access token. |
Returns:
- the http request promise
- Type
- Promise