This tutorial will talk you through logging into an account.
Before you start: Do NOT attempt to store the account details of other users unless you are very experienced in storing account details securely.
Simply storing a user's password in a file or database is inadequate security and is very irresponsible. It is a breach of the Terms Of Use to do this.
You may store your own password if you are prepared to take the risk.
First we need to require Cubed-API. To do this add the following code at the top of your JavaScript file:
Now you can login to the account with the following code:
// DependenciesconstCubedCraft=require('cubed-api');// Account Detailsconstusername='ACCOUNT_USERNAME';constpassword='ACCOUNT_PASSWORD';// Defining The Session ID Variablevar sessionID;// Logging Into The AccountCubedCraft.login(username, password).then(ses => sessionID = ses);
The variable "sessionID" will now be set to a session ID for your account. This Session ID can now be used to perform actions.