new ChinoAPIAuth(baseUrl, applicationId, applicationSecret)
Create a caller for Authentication Chino APIs This class is used to authenticate application users
Parameters:
Name | Type | Description |
---|---|---|
baseUrl |
string | The url endpoint for APIs |
applicationId |
string | The Chino application id |
applicationSecret |
string | The Chino application key |
Methods
login(username, password) → {Promise.<objects.Auth, objects.ChinoException>}
Authenticate user through username and password and if successful return a access token
Parameters:
Name | Type | Description |
---|---|---|
username |
string | |
password |
string |
Returns:
A promise that return a Auth object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.Auth, objects.ChinoException>
loginWithCode(code, redirectUrl) → {Promise.<objects.Auth, objects.ChinoException>}
Authenticate user through code returned at redirectUlr from Chino login service
Parameters:
Name | Type | Description |
---|---|---|
code |
string | |
redirectUrl |
string |
Returns:
A promise that return a Auth object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.Auth, objects.ChinoException>
logout(token) → {Promise.<objects.Success, objects.ChinoException>}
Revoke token authorization
Parameters:
Name | Type | Description |
---|---|---|
token |
string |
Returns:
A promise that return a Success object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.Success, objects.ChinoException>
refreshToken(token) → {Promise.<objects.Auth, objects.ChinoException>}
Get a new token using a old token
Parameters:
Name | Type | Description |
---|---|---|
token |
string |
Returns:
A promise that return a Auth object if resolved, otherwise throw an ChinoException object if rejected or was not retrieved a success status
- Type
- Promise.<objects.Auth, objects.ChinoException>