unmojang / FjordLauncher

Prism Launcher fork with support for alternative auth servers
GNU General Public License v3.0
96 stars 18 forks source link

drasl authlib-injector accounts doesn't have skin in single-player #32

Open vibrantrida opened 2 months ago

vibrantrida commented 2 months ago

Operating System

Windows

Version of Fjord Launcher

Fjord Launcher 8.4.2

Version of Qt

I dont know what Qt version 8.4.2 uses

Description of bug

An authlib-injector account with a self-hosted drasl server on docker doesn't have a skin even in single-player world

On Fjord Launcher's Accounts page, it shows that the status for the drasl authlib-injector account is "Ready".

On Docker I can see that Fjord requested for the skin, and I can confirm that there are no errors, the status code is 200.

2024-09-14 08:30:27 drasl-1  | {"time":"2024-09-14T00:30:27.169898842Z","id":"","remote_ip":"172.18.0.1","host":"localhost:25585","method":"POST","uri":"/authlib-injector/authserver/refresh","user_agent":"Mozilla/5.0","status":200,"error":"","latency":14592836,"latency_human":"14.592836ms","bytes_in":999,"bytes_out":1118}
2024-09-14 08:30:27 drasl-1  | {"time":"2024-09-14T00:30:27.172222094Z","id":"","remote_ip":"172.18.0.1","host":"localhost:25585","method":"GET","uri":"/authlib-injector/sessionserver/session/minecraft/profile/1daaca41ef7f4ebaac14ebe0b625305d","user_agent":"Mozilla/5.0","status":200,"error":"","latency":1045106,"latency_human":"1.045106ms","bytes_in":0,"bytes_out":469}
2024-09-14 08:30:27 drasl-1  | {"time":"2024-09-14T00:30:27.173358426Z","id":"","remote_ip":"172.18.0.1","host":"localhost:25585","method":"GET","uri":"/authlib-injector","user_agent":"Mozilla/5.0","status":200,"error":"","latency":2735,"latency_human":"2.735µs","bytes_in":0,"bytes_out":1938}
2024-09-14 08:30:27 drasl-1  | {"time":"2024-09-14T00:30:27.176466815Z","id":"","remote_ip":"172.18.0.1","host":"localhost:25585","method":"GET","uri":"/web/texture/skin/9eb7aff4ed3c27e81488ed82c2a1a19a32135d1e7d778165302edc8a07e1860e.png","user_agent":"Mozilla/5.0","status":200,"error":"","latency":2068379,"latency_human":"2.068379ms","bytes_in":0,"bytes_out":4117}

Steps to reproduce

  1. Self-host Drasl on Docker
  2. Create a Drasl account, add a custom skin, and then add an authlib-injector on Fjord Launcher
  3. Play a single-player world, open Inventory to check skin

Suspected cause

No response

This issue is unique

evan-goode commented 2 months ago

Hi, I can't reproduce this.

vibrantrida commented 2 months ago

Hi, I can't reproduce this.

* What version of Minecraft?

* Have you installed authlib-injector on the Minecraft instance in Fjord Launcher (edit instance -> Version -> Install authlib-injector)? It should prompt to install authlib-injector automatically if you try to launch the instance with an authlib-injector account selected in Fjord.

* Does the correct skin show up in the top right corner of the Fjord Launcher main window (in the account selection dropdown menu)?
evan-goode commented 2 months ago

Any relevant errors in the Minecraft Log (Edit instance -> Minecraft Log) when you load the singleplayer world (or earlier)? My first idea is that the Domain setting in your Drasl's config.toml is not set correctly.

vibrantrida commented 2 months ago

You are right, I am getting connection refused error according to the logs

Here's the relevant variables in config.toml:

# Example: drasl.example.com
Domain = "localhost:25585"

# Example: https://drasl.example.com
BaseURL = "http://localhost:25585"

I don't want to use a reverse proxy since I only plan to run this on the local network

evan-goode commented 2 months ago

Ah, I haven't tried setting up Drasl without TLS. I'll play around and see if I can get it working, but no promises. Not supporting plain HTTP might be a limitation (or conscious decision) of authlib-injector.

I recommend setting up a reverse proxy with an self-signed certificate. You could use https://caddyserver.com/docs/caddyfile/directives/tls#internal.

evan-goode commented 2 months ago

Hmm, actually plain HTTP works for me fine. I used localhost as the Domain without the :25585. But I'm not sure that would cause the error you're seeing.

This line of your logs looks relevant:

Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $

Is there anything in the Drasl log when you load the world? i.e. any Drasl logs from requests generated by the Minecraft client rather than Fjord Laucnher?

vibrantrida commented 2 months ago

There is no other logs on Drasl's side other than when Fjord sent a request to it.

evan-goode commented 2 months ago

A couple more things to check:

[authlib-injector] [INFO] Authentication server: http://localhost:25585/authlib-injector
[authlib-injector] [WARNING] You are using HTTP protocol, which is INSECURE! Please switch to HTTPS if possible.

If that doesn't help, the next thing I would do to debug is to man-in-the-middle the traffic between the Minecraft client and Drasl. It looks like the client is sending requests to the wrong place (something, probably not Drasl, is responding with "Internal server error"). I use mitmproxy for this but there are alternatives.

Then in Fjord Launcher, you'll need to go to Edit Instance -> Settings -> Java -> Java arguments and add

-Dhttp.proxyHost=localhost -Dhttp.proxyPort=8080 -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8080

to proxy traffic through mitmproxy (or whatever).

There's a little more setup involved if you want to decrypt HTTPS traffic, but that might not be necessary here. Feel free to ask in https://matrix.to/#/!nntYkUIkaZiKmXZYne:matrix.org?via=matrix.org&via=envs.net&via=besties.house if you want more guidance.