# Authenticating with Screeps

Screeps has recently introduced a [token-based auth system](http://blog.screeps.com/2017/12/auth-tokens/), and the old authentication system will be deprecated by 01 February 2018. The starter kit has been updated to support this new authentication process.

## Migrating to the new auth system

If you have an existing copy of your starter kit, follow these steps:

* Remove the `"username"` and `"password"` keys from your `screeps.json` file, and replace them with `"token"`.
* Upgrade `rollup-plugin-screeps` to version 0.1.1.
* Follow the authentication steps as defined below.

## Setting up Screeps authentication

The authentication token is pulled by the starter kit from a file named `screeps.json`. A sample config file (`screeps.sample.json`) is provided within the project, to use it, simply make a copy and rename it to `screeps.json`.

```bash
cp screeps.sample.json screeps.json
```

{% hint style="danger" %}
**IMPORTANT:** The `screeps.json` file contains your Screeps credentials! If you use any source control to store your codebase, **DO NOT** check in this file into your repository.
{% endhint %}

## Generating an auth token

To generate an authentication token, click **\[your username] > Manage account**. You should see the **Auth tokens** in the options now, click it.

![authenticating-1](/files/-MgbOTYgi2PzGXKW_TTH)

On the next screen, we'll create a full access token. We pick the **Full access** option, then click the **Generate Token** button.

![authenticating-2](/files/-MgbOTYh_rrhsAqMz_ro)

Your generated token should now be shown on your screen. Copy it to your clipboard.

![authenticating-3](/files/-MgbOTYidkpv0Imzz730)

> **Note:** This token will be displayed **only once**! Make sure to never lose it. However, if you did lose it, simply remove said token from your account, and create a new one.

Now, paste it to your `screeps.json` file.

![authenticating-4](/files/-MgbOTYj5a-KMKRC62h5)

## Sanity check

Now we'll do a quick check if things are running properly. Let's perform a quick deploy.

```bash
npm run push-main
```

Now go to your Screeps client and check if the `main` branch is created, or if said branch already exists, the code is overwriten to it.

It works? Good, you've successfully authenticated!

Next up, we'll configure our environment and [run our first code deploy](/screeps-typescript-starter/getting-started/deploying.md).


---

# 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://screepers.gitbook.io/screeps-typescript-starter/getting-started/authenticating.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.
