How does authorization and other things work in Realms Alpha

This page describes the interaction algorithm between the Minecraft PE client and server-side components to implement the Realms Alpha functionality

Initial Setup

To implement Realms Alpha functionality, you need:

Important: You need to replace the authorization URL string in the binary file. The new URL must be the same length as the original to avoid breaking the binary structure.

1. Player Authorization Process

Step 1: Login Trigger

When a player clicks "Login" in the game settings, the authorization process begins.

Step 2: Authorization Redirect

After successful authentication, redirect the player to your server with the following URL format:

http://site/m/launchmc?accessToken=(PLAYER_TOKEN)&clientToken=(CLIENT_TOKEN)&sessionId=(SESSION_ID)&identity=(IDENTITY)&profileName=(PLAYER_NICKNAME)&profileUuid=(PLAYER_UUID)&email=(EMAIL)&newUser=(true_if_new_player_otherwise_false)

Parameters Explanation:


2. Realms Service Status

Endpoint: GET /peo/info/status

The game sends this request on every launch (and possibly after authorization) to check the availability of Realms service.

Required Response (JSON):

{
    "buyServerEnabled": false,
    "createServerEnabled": false, 
    "serviceEnabled": true
}

Parameter Details:


3. Server List Request

Endpoint: GET /peo/server/list

When entering Realms, the game requests the list of available servers.

Response Format:

The response should be a JSON array of server objects with the following structure:

class ServerInfo {
    [JsonProperty("id")]
    public int ID { get; set; }

    [JsonProperty("name")]
    public string Name { get; set; }

    [JsonProperty("open")]
    public bool IsOpen { get; set; }

    [JsonProperty("ownerName")]
    public string OwnerName { get; set; }

    [JsonProperty("myWorld")]
    public bool IsMyRealms { get; set; }

    [JsonProperty("maxNrPlayers")]
    public int MaxPlayers { get; set; }

    [JsonProperty("playerNames")]
    public string[] PlayerList { get; set; }

    [JsonProperty("type")]
    public string RealmsType { get; set; }

    [JsonProperty("serverId")]
    public int ServerId { get; set; }

    [JsonProperty("invited")]
    public string[] InvitedPlayers { get; set; }
}

Property Descriptions:


4. Token Refresh

Endpoint: POST /refresh

The game sends this request on each game launch to refresh authentication tokens.

Request Body (JSON):

{
    "accessToken": "token",
    "clientToken": "client_token",
    "selectedProfile": {
        "name": "PlayerNickname"
    }
}

5. Server Connection

Endpoint: POST /peo/server/{server_index}/join

When a player clicks to connect to a server, the game sends this request.

URL Parameter:

Response Body (JSON):

{
    "ip": "127.0.0.1",
    "port": 19132,
    "serverId": "0"
}

Response Parameters:


Attached Files

VBAmjnju.cs

Implementation Notes

Server Integration: If you want players to automatically access the server without additional registration, you can use the Realms data passed to your server. However, this requires either using a custom server core or modifying PocketMine-MP, as this functionality is not implemented by default.
Binary Modification Warning: Modifying the game binary requires careful attention to string lengths. The replacement authorization URL must be exactly the same length as the original to prevent corruption.

The information provided is based on content written by the user Flusitk (see original file). LegacyMinecraftPE assumes no responsibility for the material presented here or for the files made available.