Methods
create(requestData) → {Promise.<{token: string, expires: number}>}
Generate a new Token [POST /token/new]
This method is used to generate a new JWT for User or API Key based authentication. You can think of this as the 'Login Process'.
User Authentication The user must have an account that has been created on RICADO. A valid Email Address and Password will be required.
API Key Authentication A valid API Key and API Secret will be required. These can be created in the RICADO Admin App at admin.ricado.co.nz.
Parameters
-
requestData
Object
|Object
The Request Data
Returns
-
Promise.<{token: string, expires: number}>
Source
delete(id) → {Promise.<boolean>}
Delete a Token [DELETE /tokens/{id}]
Parameters
-
id
string
The Token ID
Returns
-
Promise.<boolean>
Source
destroy() → {Promise.<boolean>}
Destroy the current Token [POST /token/destroy]
This method is used to destroy an existing JWT. This method should be used to effectively 'logout' a User or API Key. Once this method has been successfully called, the JWT can no longer be used for any API calls.
Returns
-
Promise.<boolean>
Source
getAll(queryParametersopt) → {Promise.<Array.<TokenModel>>}
List all Tokens [GET /tokens]
Parameters
-
queryParameters
TokenController.GetAllQueryParameters
<optional>
The Optional Query Parameters
Returns
-
Promise.<Array.<TokenModel>>
Source
getCurrent() → {Promise.<TokenModel>}
Retrieve the current Token [GET /token]
Retrieves the Token that is currently being used.
Returns
-
Promise.<TokenModel>
Source
getOne(id) → {Promise.<TokenModel>}
Retrieve a Token [GET /tokens/{id}]
Parameters
-
id
string
The Token ID
Returns
-
Promise.<TokenModel>
Source
lock() → {Promise.<boolean>}
Lock the current Token [POST /token/lock]
This method is used to lock an existing JWT. Once the Token has been locked, any further API calls will be denied until the Token has been unlocked.
Returns
-
Promise.<boolean>
Source
unlock(requestData) → {Promise.<boolean>}
Unlock the current Token [POST /token/unlock]
This method is used to unlock an existing JWT. Tokens can be locked by the server or via an API call. The user's pin code or password is used as authentication to unlock the token.
Parameters
-
requestData
TokenController.PinCodeUnlock
|TokenController.PasswordUnlock
The Request Data
Returns
-
Promise.<boolean>
Source
Type Definitions
GetAllQueryParameters
The Optional Query Parameters for the getAll Function
Type
-
Object
Properties
-
accountId
string
<optional>
The Account this Token belongs to
-
accountType
string
<optional>
The Account Type
-
issueTimestamp
Date
<optional>
When the Token was issued
-
expireTimestamp
Date
<optional>
When the Token will expire
-
activityTimestamp
Date
<optional>
<nullable>
When the last API call using this Token was made
Source
PasswordUnlock
A PasswordUnlock Type
Type
-
Object
Properties
-
password
string
The User's Password
Source
PinCodeUnlock
A PinCodeUnlock Type
Type
-
Object
Properties
-
pinCode
string
The User's Pin Code