Document auth server APIs #1

Open
opened 2024-02-09 21:31:39 +01:00 by xiretza · 1 comment
Owner

...and put them on the Factorio wiki

...and put them on the [Factorio wiki](https://wiki.factorio.com/Factorio_HTTP_API_usage_guidelines#Internal)
Author
Owner

1. Server startup

POST /generate-server-padlock-2?api_version=6 HTTP/1.1
Host: auth.factorio.com
User-Agent: Factorio/1.1.101 (build 62011, linux64, headless; Linux)
Accept: */*
Content-Length: 0
Content-Type: application/x-www-form-urlencoded

{"server_hash": "hnGD7bKZnUEdUYWxtK3ODzmNV0oUckIA", "server_padlock": "ZjX+YSCEZgdFMVCzLLt8F8NOoWAmAG9WkUwv1dir4gg="}

2. Client joins server

POST /generate-user-server-key-2?api_version=6 HTTP/1.1
Host: localhost:1234
User-Agent: Factorio/1.1.101 (build 62011, linux64, full; Linux (Arch rolling))
Accept: */*
Content-Length: 98
Content-Type: application/x-www-form-urlencoded

username=Xiretza&token=9a373648c72b37bd4fa9fd29d0c3ea&server_hash=hnGD7bKZnUEdUYWxtK3ODzmNV0oUckIA
{"server_key": "nV89TIBaIOvwUDQwrdK0/Q==", "server_key_timestamp": "240208183717"}

3. Server confirms key

$ set padlock ZjX+YSCEZgdFMVCzLLt8F8NOoWAmAG9WkUwv1dir4gg=
$ set username Xiretza
$ set timestamp 240208183717

$ printf '%s_%s_%s' $username $padlock $timestamp | openssl mac -digest md5 -macopt key:$padlock -binary HMAC | base64
nV89TIBaIOvwUDQwrdK0/Q==
# 1. Server startup ``` POST /generate-server-padlock-2?api_version=6 HTTP/1.1 Host: auth.factorio.com User-Agent: Factorio/1.1.101 (build 62011, linux64, headless; Linux) Accept: */* Content-Length: 0 Content-Type: application/x-www-form-urlencoded ``` ``` {"server_hash": "hnGD7bKZnUEdUYWxtK3ODzmNV0oUckIA", "server_padlock": "ZjX+YSCEZgdFMVCzLLt8F8NOoWAmAG9WkUwv1dir4gg="} ``` # 2. Client joins server ``` POST /generate-user-server-key-2?api_version=6 HTTP/1.1 Host: localhost:1234 User-Agent: Factorio/1.1.101 (build 62011, linux64, full; Linux (Arch rolling)) Accept: */* Content-Length: 98 Content-Type: application/x-www-form-urlencoded username=Xiretza&token=9a373648c72b37bd4fa9fd29d0c3ea&server_hash=hnGD7bKZnUEdUYWxtK3ODzmNV0oUckIA ``` ``` {"server_key": "nV89TIBaIOvwUDQwrdK0/Q==", "server_key_timestamp": "240208183717"} ``` # 3. Server confirms key ```fish $ set padlock ZjX+YSCEZgdFMVCzLLt8F8NOoWAmAG9WkUwv1dir4gg= $ set username Xiretza $ set timestamp 240208183717 $ printf '%s_%s_%s' $username $padlock $timestamp | openssl mac -digest md5 -macopt key:$padlock -binary HMAC | base64 nV89TIBaIOvwUDQwrdK0/Q== ```
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: xiretza/factoriauth#1
No description provided.