Skip to content

Commit

Permalink
Added a workaround in the README in case the epicGamesAccount mode …
Browse files Browse the repository at this point in the history
…fails (#23)
  • Loading branch information
NikkelM authored Sep 6, 2024
1 parent cc99a47 commit 9f60c38
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ You can then use it here to avoid having to log in again.

## Mode: `epicGamesAccount`

> It is possible that running the tool in this mode will not work due to Epic Games running an additional security check (captcha) when trying to access the purchase history.
> If you encounter this issue, please use the [workaround](#workaround-if-the-tool-throws-an-error) provided below.
This mode enables you to get a list of all games you have ever purchased (excluding those that are refunded) on the Epic Games Store - including the weekly free game giveaways.
You can then use this output as input for the [`gameNames`](#mode-gamenames) mode to find the Steam App IDs for the games.

Expand Down Expand Up @@ -464,6 +467,36 @@ To do this, simply set the following as the value of the `inputFile` property in
}
```

### Workaround if the tool throws an error

If the tool throws an error when trying to fetch games from your Epic Games account, it is possible that the tool's access to your account is being blocked by an additional security check run by Epic Games.
As a workaround, please follow the following steps to manually fetch a list of games from the browser:

1. Log in to your account and go to [https://www.epicgames.com/account/transactions](https://www.epicgames.com/account/transactions).
2. Open the developer console of your browser (usually by pressing `F12` or `Ctrl+Shift+I`).
3. Go to the `Console` tab of the console. This is usually the default tab when opening the developer view.
4. Paste the following code snippet into the console and press `Enter`. This will fetch the list of purchased games from your account using the same method as the tool would.

```javascript
const fetchGamesList = async (pageToken = '', existingList = []) => {
const data = await (await fetch(`https://www.epicgames.com/account/v2/payment/ajaxGetOrderHistory?sortDir=DESC&sortBy=DATE&nextPageToken=${pageToken}&locale=en-US`)).json();
const gamesList = data.orders.reduce((acc, value) => [...acc, ...value.items.map(v => v.description)], []);
console.log(`Games on this page: ${gamesList.length}, Next page starts from date: ${data.nextPageToken}`);
const newList = [...existingList, ...gamesList];
if (!data.nextPageToken) return newList;
return await fetchGamesList(data.nextPageToken, newList);
}
fetchGamesList().then(console.log);
```

5. The console will output the list of games you have purchased on the Epic Games Store.
6. Right-click on the output (the list of game names) and select `Copy object`.
7. Create a new text (`.txt`) file (e.g. through Notepad), paste the copied object into the file and save it.

Optionally, you can now use the saved file as input for the [`gameNames`](#mode-gamenames) mode to find the Steam App IDs for the games.
Note that due to the formatting of the output you get from the workaround, you will need to set the following as the `delimiter` option in your configuration file to get the best results: `\",\r\n \"`
For best results, also remove the leading `[` and trailing `]` from the file.

### Configuration: `epicGamesAccount`

#### Properties
Expand Down
8 changes: 3 additions & 5 deletions js/epicGames.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export async function getEpicGamesGames() {
}

for (const game of page.orders) {
if(game.items[0].status !== "REFUNDED")
games.push(game.items[0].description);
if (game.items[0].status !== "REFUNDED")
games.push(game.items[0].description);
}

lastCreatedAt = new Date(page.orders.slice(-1)[0].createdAtMillis).toISOString();
Expand All @@ -72,7 +72,6 @@ async function getPage(pageNumber, lastCreatedAt) {
return data;
});

// console.log(response);
return response;
}

Expand All @@ -88,6 +87,5 @@ async function getFirstPage() {
return data;
});

// console.log(response);
return response;
}
}

0 comments on commit 9f60c38

Please sign in to comment.