Constructs an instance of this driver.
This driver's provider name.
The config parameters of this driver's provider.
The driver's codeFieldName. This field indicates the name of the code field in this driver. Its value should always be 'code'.
The driver's dataFieldName. This field indicates the name of the data field in this driver. Its value should always be 'state'.
The driver's HTTP service. It's a handler for HTTP requests and contains
methods for executing remote API calls, e.g. calling a GET
HTTP API
endpoint.
The driver's value to determine whether seconds are used to express
UTC timestamps (if set to false, milliseconds are used). This field
indicates the type of timestamp returned with this driver.
By default, as defined below, we expect OAuth drivers to not use
seconds and instead use milliseconds. Extending driver classes
can override this field value to specify the use of seconds instead.
Getter of this driver's code field name.
This driver's code field name.
Getter of this driver's data field name.
This driver's data field name.
Getter of this driver's provider name.
This driver's provider name.
Getter that determines whether this driver uses seconds (rather than milliseconds) to express a timestamp in UTC format.
Whether this driver uses seconds to express UTC timestamps.
Method to return the authorize query to this driver's provider.
This is the query parameters that will be included after the
authorized url.
Note that it contain 3 fields client_id
, redirect_uri
and
state
(this driver's dataField
).
The data
value to include in this query.
The full query parameters.
Method to execute a request calling the driver's provider API.
The access token attached as a Bearer token to the request.
The endpoint URI of the driver's provider API.
(Optional) The HTTP method used for the request, e.g. "GET". Defaults to "GET".
(Optional) The body of the request, as used with "POST" or "PUT" requests. Defaults to an empty object.
(Optional) An options object that is directly passed to axios before request execution. Defaults to an empty object.
A promise containing the response and status in ResponseStatusDTO.
Helper method that extracts access- and refresh tokens, and
expiration time of the access token from a HTTP response.
A method overload can be implemented in extending OAuth driver
classes to permit extracting additional fields, e.g. Strava
shares an athlete
object with initial access token requests.
Note that this method automatically transforms UTC timestamps
that use seconds since epoch into UTC timestamps that use
milliseconds since epoch as defined in driver implementations.
The HTTP response data (parsed JSON object).
A resulting AccessTokenDTO object.
Method to return the remote access token. The result is an access/refresh
token pair. This method requires the use of an authorization code that
is provided by the provider.
These access tokens are always signed with the dApp's auth secret and expire
after 1 hour (one hour).
The required code
field value.
The required data
field value.
A promise containing the result AccessTokenDTO.
Method to return the authorize url of this driver's provider.
The data
field value to include in this query.
The full authorize url to send request to.
Method to transform an entity as described by the data provider
API. Typically, this method is used to handle the transformation
of remote objects (from data provider API) to internal objects in
the backend runtime's database.
e.g. This method is used to transform activity data as defined
by the Strava API, into ActivityData as defined internally.
Note that this implementation does not transform the remote data
because this class corresponds to a generic OAuth implementation
and as such must be compatible with any entity. For more details
on specializations of this method, you may have a look at the code
in StravaOAuthDriver.getEntityDefinition.
The API Response object that will be transformed.
The type of entity as described in OAuthEntityType.
A parsed entity object.
Helper method that executes the actual access token request using a set
of params
parameters. The parameters set must contain the following
fields:
client_id
: Your Strava App's client identifier.client_secret
: Your Strava App's client secret.grant_type
: One of authorization_code
or refresh_token
.
authorization_code
and code
are obligatory as well.
When executing a refresh request for the access token, it is the field
refresh_token
that is obligatory (no code).The parameters for the access token request.
A promise containing the resulting AccessTokenDTO object.
Method to return an updated access token from the driver's provider
using a refresh token. The result is an access/refresh token pair.
These access tokens are always signed with the dApp's auth secret and expire
after 1 hour (one hour).
The user's refresh token.
A promise containing the result AccessTokenDTO.
Generated using TypeDoc
The dApp basic OAuth driver. This class is used to determine communication, transport and process that are used to connect and integrate to custom providers.
v0.3.0