All methods that requires authentication (dashboard API) are moved to client.dashboard
.
example:
- client.stats()
+ client.dashboard.stats()
The methods left on client
don't need authentication and are uuid bound.
earnapp.js is a Node.js module that allows you to easily interact with the EarnApp API.
- Promise-based
- Performant
- 100% coverage of the EarnApp API
- Install NodeJS.
- Download or clone the project.
- Go to the
earnapp.js
folder and runnpm install
. - Require
client.js
.
- Run
npm install earnapp.js
. - Require the library.
The library can be used in both CommonJS and ES Modules
The library is async, be sure to use async functions or .then()
const { Client } = require("earnapp.js");
//OR
import { Client } from "earnapp.js";
const client = new Client();
client.dashboard.login({
authMethod: "google",
oauthRefreshToken: "1%2F%2F0dx...mfz75",
xsrfToken: "uE9Tm4sXtk4wHEz4tZFJyANB",
//needed for endpoints like linking a device / or making a payout
});
client.dashboard.stats().then((data) => {
console.log(data);
});
//OR
const getStats = async () => {
const data = await client.dashboard.stats();
console.log(data);
};
getStats();
You can also get the CSRF token and login like this:
const main = async () => {
const cookie = "1%2F%2F0dx...mfz75";
const { token } = await client.dashboard.getCSRF({
authMethod: "google",
oauthRefreshToken: cookie,
});
client.dashboard.login({
authMethod: "google",
oauthRefreshToken: cookie,
xsrfToken: token,
//needed for endpoints like linking a device / or making a payout
});
};
main();
See the license