In other languages:

Download API: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 3: Line 3:
== Authenticating ==
== Authenticating ==


Downloading Factorio requires an authenticated session with the web server, which is different than the typical authentication mechanism. To log in, create an HTTP session and GET <code>https://www.factorio.com/login</code>. There's a CSRF token you'll need to grab which can be found using the CSS selector <code>input[name=csrf_token]</code> or alternatively XPATH <code>//input[@name="csrf_token"]/@value</code>.
Downloading Factorio requires an authenticated session with the web server, which is different than the typical authentication mechanism. To log in:
# Create an HTTP session and GET <code>https://www.factorio.com/login</code>.<br>There's a CSRF token you'll need to grab which can be found using one of the following selectors:
#* CSS1: <code>input[name=csrf_token]</code>  
#* XPATH1: <code>//input[@name="csrf_token"]/@value</code>.
# Then send a POST to <code>https://www.factorio.com/login</code> with the following parameters:
#* <code>csrf_token</code>: the CSRF token you grabbed earlier.
#* <code>username_or_email</code>: your username or email address.
#* <code>password</code>: your password.


{{Languages}}[[Category:Technical]]
{{Languages}}[[Category:Technical]]

Revision as of 03:01, 1 August 2017

This API allows you to download official releases of stand-alone Factorio from the Factorio servers. It's not so much of an API as it is web scraping, but it's documented here for completeness. Please update this page if you utilize it and the information becomes outdated. Also note that's there's a separate, (semi)official API for upgrading between releases, which should be used when possible to lighten load on the Factorio servers. (I'll document that later, promise!)

Authenticating

Downloading Factorio requires an authenticated session with the web server, which is different than the typical authentication mechanism. To log in:

  1. Create an HTTP session and GET https://www.factorio.com/login.
    There's a CSRF token you'll need to grab which can be found using one of the following selectors:
    • CSS1: input[name=csrf_token]
    • XPATH1: //input[@name="csrf_token"]/@value.
  2. Then send a POST to https://www.factorio.com/login with the following parameters:
    • csrf_token: the CSRF token you grabbed earlier.
    • username_or_email: your username or email address.
    • password: your password.