Implement Mojang authentication #4

Merged
kodi merged 5 commits from auth into main 2024-10-07 11:26:31 +02:00
Showing only changes of commit e45258ba6f - Show all commits

View File

@ -113,7 +113,7 @@ defmodule Amethyst.ConnectionState.Login do
hash = Amethyst.Minecraft.Sha1.hash(secret <> pubkey) hash = Amethyst.Minecraft.Sha1.hash(secret <> pubkey)
url = Application.get_env(:amethyst, :session_server, "https://sessionserver.mojang.com") <> "/session/minecraft/hasJoined?username=" <> url = Application.get_env(:amethyst, :session_server, "https://sessionserver.mojang.com") <> "/session/minecraft/hasJoined?username=" <>
Map.get(state, :name) <> "&serverId=" <> hash # I don't think we need to verify the IP in the use case of Amethyst... Map.get(state, :name) <> "&serverId=" <> hash # I don't think we need to verify the IP in the use case of Amethyst...
Logger.debug(url)
response = Req.get!(url, response = Req.get!(url,
headers: [ headers: [
{"user-agent", "Amethyst/1.0"} {"user-agent", "Amethyst/1.0"}