Nodejs library to interact with COROS Api.
This project is inspired by:
npm install coros-connect
You can setup a configuration file on your project root called coros.config.json
containing your email and password.
{
"email": "my.email@example.com",
"password": "MySecretPassword"
}
Or you can provide on the constructor or login
command.
const coros = new CorosApi({
email: "my.email@example.com",
password: "MySecretPassword"
});
await coros.login("my.email@example.com","MySecretPassword");
You can change some default configuration for the service to adapt to the coros website changes on the environment variable.
// check properties that can be update from the function types
coros.config({
stsConfig: STSConfigs.EU
})
You can store the access token to a file so you can reuse the same token when creating a new client. This is useful as you can get a 429 response from COROS Api.
if (isDirectory(tokenFolder)) {
coros.loadTokenByFile(tokenFolder);
} else {
await coros.login();
coros.exportTokenToFile(tokenFolder);
}
This library only supports the following:
- Login on Coros and get an access token.
- Get list of activities.
- Get activity detail (and other data used on the Coros page for the activity).
- Download an activity file.
- Store and reuse access token.
- Get profile
- Upload activity file (fit and tcx) from other providers. (see upload notes on coros webapp).
- Delete activity
- Change configuration to adapt to different environment
- Handle token expiration or invalid token. NOTE when you login using this package, it will automatically logout from the webapp (mobile app is ok). And when you login into the webapp, it will invalidate your token. So at the moment you have to handle this logic.
You can find one example on here