# Logging Into An Account

{% hint style="danger" %}
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.
{% endhint %}

First we need to require Cubed-API. To do this add the following code at the top of your JavaScript file:

```javascript
// Dependencies
const CubedCraft = require('cubed-api');
```

Now you can login to the account with the following code:

```javascript
// Dependencies
const CubedCraft = require('cubed-api');

// Account Details
const username = 'ACCOUNT_USERNAME';
const password = 'ACCOUNT_PASSWORD';

// Defining The Session ID Variable
var sessionID;

// Logging Into The Account
CubedCraft.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.

{% hint style="info" %}
Make sure you have read the guide on Session ID's so you understand what you are doing with a session ID: <https://pondwadermc.gitbook.io/cubed-api/tutorials-and-guides/sessions>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pondwadermc.gitbook.io/cubed-api/tutorials-and-guides/logging-into-an-account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
