
I would like the take the very first paragraph to get the logical basics down. Programming implementation down the road is “just” a question of a language syntax.
Before I wrote anything there was reconnaisance to be made. With the help of the Chrome Developer tools I recorded the steps needed to login to the overview page (automatic redirect).
Login consists of the two levels:
- Login with the e-mail which takes us to the overview of servers and already active accounts
- Login to the specific account
Firstly I needed to set the minimum goal. The goal was to successfully login to the game and just output the pure html; if successful I would get the wall of text in the console, otherwise just a short piece of redirect code (HTTP 3011).
Using apitester.com for quick and dirty test.

If successful, the post request should return the token, among other things.
Request url:
https://gameforge.com/api/v1/auth/thin/sessions
Request method:
POST
Request body:
identity=YOUR_EMAIL&password=YOUR_PASSWORD&locale=de_DE&gfLang=de&platformGameId=1dfd8e7e-6e1a-4eb1-8c64-03c3b62efd2f&gameEnvironmentId=0a31d605-ffaf-43e7-aa02-d06df7116fc8&autoGameAccountCreation=false
Request valid response body:
Request invalid response body:

The whole flow, then, is one POST that forks:
flowchart LR
A[POST credentials] -->|valid| B[200 OK<br/>bearer token]
A -->|invalid| C[403 Forbidden]
B --> D[GET accounts<br/>for this player]
Let’s see how the first step looks like. Used library: request-promise 2 Success criteria: fetch all the accounts bound to the user/player
const rp =
var user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36';
const tough = ;
var jar = rp.;
var links = ;
login_post_options = ;
get_options = ;
;
;
.;
More on HTTP codes: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
https://github.com/request/request-promise, deprecated as of 1st of April 2020