Auto purchase free Epic Games content

In this post I am going to teach you how to automate the process of acquiring the free games that Epic Games gives away and saving them in our library forever.

It’s a github project by Charlie Laabs which really surprised me.

Requirements:

  • Have docker installed! (In my case on Ubuntu Server)

First step

The first step is to make a configuration file with all our necessary information to run the container.

Go ahead and create a folder for the project, then create a new file, name it config.json and copy the following content into it:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
  "runOnStartup": true,
  "cronSchedule": "5 16 * * *",
  "logLevel": "info",
  "webPortalConfig": {
    "baseUrl": "http://ipofyourmachine:3000",
  },
  "accounts": [
    {
      "email": "youremail",
      "password": "yourpassword",
      "totp": "yoursuperlongcode"
    },
  ],
  "notifiers": [
    {
      "type": "telegram",
      "apiUrl": "https://api.telegram.org",
      "token": "yourtoken",
      "chatId": "yourchatID",
    }
  ]
}

Next we have to take care of filling in the missing information. The first and easiest thing will be to write your Epic Games email and password.

TOTP Code

To get this code you must activate the double factor authentication of your Epic Games account, and if you already had it activated, you must configure it again here from the beginning to get the code.

It’s simple:

  1. Download a two-way authentication app on your phone, if you didn’t have one before. I use Authy.
  2. Click on activate 2FA in Epic Games, a QR code and a very long code (TOTP) will appear.
  3. Copy the TOTP code into the above config.json file.
  4. Scan the QR with your authenticator app to add the account.
  5. To confirm the process, enter the code provided by the application on the Epic Games website.

Ready. You already have 2FA configured and you have your TOTP code.

Telegram Bot

To interact with the container (verify captchas) we will create a telegram bot.

  1. Open a new chat with @BotFather.
  2. Type /newbot and follow the instructions to create the new bot. (Name of the bot and your username).
  3. When the bot is created you will be provided with a token. This is what you should copy into the config.json file.

In order to get the chat ID:

  1. Create a new group with your bot, and also add @RawDataBot as well.
  2. As soon as the group is created, RawDataBot will provide you with the chat id.
  3. Copy this number (with the negative sign) to the config.json file.

Base URL

In baseUrl you have to put the IP of the machine that is running docker and the port of the container (default 3000).

Second step

Once we have finally configured our file, it is time to use docker.

We will use the following command:

docker run -d -v /path/configuration/folder/:/usr/app/config:rw -p 3000:3000 -m 2g charlocharlie/epicgames-freegames:latest

Attention: you must place to the left of the colon the path to the project folder, which contains the config.json file. You can change the external port if you already have it in use, changing the 3000 on the left for 3001 (or any other port you want) and of course changing it in the baseUrl attribute that we have previously placed.

After executing the command, if everything went well, you should have received a message from your bot to Telegram with a link to login. If the link does not work, the IP of the machine may not be configured correctly. Make sure it has a static IP so it doesn’t change.

Third step

After you have successfully logged in, it will automatically search for free games that you don’t have and buy them automatically. Always check the telegram bot in case you need to solve more captchas. 😃