factorio-updater icon indicating copy to clipboard operation
factorio-updater copied to clipboard

Get login tokens from the Factorio API when needed

Open narc0tiq opened this issue 8 years ago • 5 comments

Look into what fac does and do something similar.

Update player-data.json as needed and read it when the --user and/or --token are left out of the command line.

narc0tiq avatar May 11 '17 08:05 narc0tiq

Just a question. May be this isn't the place for this, but I don't know where to ask, In the forums I didn't find anything.

How can I obtain the login token? I've looked on the specified data directory, but the player.json is missing. Is there a request I can do to the API so I can obtain the token?

Kind Regards

VRabadan avatar Jun 15 '17 18:06 VRabadan

Which Factorio (standalone, installer, Steam) do you have and where did you search? And it's not player.json, but player-data.json.

Yes, there must be an API request to obtain the token. I haven't looked into it, though.

On a brief skim of fac's source, it looks like it's a POST to https://auth.factorio.com/api-login with the data username=bla&password=1234. So this worked:

[narc@odin ~]% curl -X POST --data 'username=Narc&password=<ellided>' https://auth.factorio.com/api-login
["f8f4<ellided>"]

narc0tiq avatar Jun 16 '17 07:06 narc0tiq

Thanks for the Tip, I managed to get my headless server running and published. Don't know why the file "player-data.json" is missing tho.

Kind Regards

VRabadan avatar Jun 23 '17 06:06 VRabadan

Well, without answering the original questions (which Factorio, where did you search?), I can't help you. The README has a section specifically for finding the file, but I assume you've read that already.

Regardless, I'm glad you managed to get it some other way.

narc0tiq avatar Jun 23 '17 07:06 narc0tiq

BTW, the web-auth API is documented here.

Dev-iL avatar Dec 18 '17 16:12 Dev-iL