From caf39b6f429cdaf323b8d11d9dd8a4e89d0a17a6 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Wed, 31 Aug 2022 15:01:40 -0400 Subject: [PATCH] [U] Save uuid as well --- README.md | 9 +++++++-- mc_authn/__init__.py | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6054677..09d54bc 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,15 @@ ClientSecret: Paste the "Value" you copied here You can now run `mc-auth` to login! After logging in, it will create a text file `~/.config/mc-auth/mc-token.txt` containing your minecraft token. -In your start script for minecraft, add this line before the `java` command: +In your start script for minecraft, add the `--accessToken` argument to the java line used to start minecraft: ```shell -export auth_access_token=$(< ~/.config/mc-auth/mc-token.txt) +export uuid=$(< ~/.config/mc-auth/mc-uuid.txt) +export auth=$(< ~/.config/mc-auth/mc-token.txt) + +java ... net.minecraft.client.main.Main ... \ + --accessToken ${auth} \ + --uuid ${uuid} ``` #### 3. Start Minecraft! diff --git a/mc_authn/__init__.py b/mc_authn/__init__.py index 74a0beb..19f9370 100644 --- a/mc_authn/__init__.py +++ b/mc_authn/__init__.py @@ -174,8 +174,11 @@ def get_mc_token(xsts_token: str, user_hash: str) -> str: write(out_path, json_stringify(r, indent=2)) printc(f'&a> Success! Response saved to {out_path}') + mc_uuid = config_path / 'mc-uuid.txt' mc_token = config_path / 'mc-token.txt' + write(mc_uuid, r['username']) write(mc_token, r['access_token']) + printc(f'&a> Minecraft UUID saved to {mc_uuid}') printc(f'&a> Minecraft token saved to {mc_token}') return r['access_token']