The KrossClint class is a client for interacting with the Kross API's auth-related endpoints and other instances/clients like loans, investments and inquiry. It extends the KrossClientBase class and provides methods for login and refreshing tokens.
Constructor
Methods
- login()
- updateAuthToken()
Constructor
The KrossClient class constructor accepts a KrossClientOptions object as its only argument. This object is used to configure the underlying Axios instance that makes the HTTP requests to the Kross API.
import { KrossClient } from 'kross-sdk';
const krossClient = new KrossClient({
baseURL: 'https://api.kross.com',
accessId: 'afsdfsdfjsdfsd',
secretKey: 'sdfsdfsdfsdfsdf',
});
Methods
- login()
The login()
method is used to login.
krossClient.login({
'abcd@gmail.com',
'abcd1234',
true,
});
keyid
- email or business registeration number that user used while creating account
password
- as name suggest
refreshExpiresIn (Optional)
- refreshExpiresIn to set token expiry in milli seconds
Return a response on success
{
"token": "string",
"refresh": "string"
}
- updateAuthToken()
The updateAuthToken()
method is used to refresh tokens.
client.updateAuthToken();
Return response on success
{
"token": "string"
}
Hooks
login(
{
keyid: 12323554646456,
passoword: 132323555,
},
{
onSuccess: response => {},
onError: error => {},
}
);