Methods
(static) api(req) → {Promise}
Configures and makes the required Http call by attaching the COCO access token.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
req |
Object | Request object provided as input by the client
Properties
|
Returns:
- Promise containing XMLHttpRequest with either data or error
- Type
- Promise
(static) getAccessToken() → {Promise}
Get COCO access token of the user logged in
Returns:
- Type
- Promise
(static) init(config, expiringCallback, expiredCallback) → {Promise}
Create config using input from client and predefined
static values configured from our end
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | Configuration object provided as input by the client
Properties
|
||||||||||||
expiringCallback |
function | callback function called before 5 mins of token expiry | ||||||||||||
expiredCallback |
function | callback function called when access token is expired |
Returns:
- Type
- Promise
(static) isLoggedIn() → {Promise}
Check presence of valid access token to assess logged in status.
Returns:
Boolean result true for logged in and false otherwise.
- Type
- Promise
(static) login() → {Promise}
Start login by sending authorization request to our authorization server.
Returns:
- Type
- Promise
(static) logout() → {Promise}
Logout the user by removing the access token
Returns:
- Type
- Promise