Authentication#

async minecraft.auth.get_access_token(token)#

Exchanges a Microsoft access token for a Minecraft access token.

Parameters:

token (str) – The Microsoft access token.

Returns:

The Minecraft access token, player UUID, and username.

Return type:

tuple[str, str, str]

async minecraft.auth.microsoft_auth(client_id: str) tuple[str, str, str]#

Authenticates through Microsoft with a device code authentication flow.

Note

This requires that msal is installed.

Parameters:

client_id (str) – The ID of the Microsoft OAuth2 client you want to authenticate with.

Returns:

A tuple containing the name, UUID, and access token of the authenticated user.

Return type:

tuple[str, str, str]

Raises:
async minecraft.auth.obtain_token_with_device_code(clientapp: msal.PublicClientApplication) dict#

Obtains a Microsoft access token using the device code flow.

Parameters:

clientapp (msal.PublicClientApplication) – The MSAL client application.

Returns:

Authentication information returned by the Microsoft OAuth2 server.

Return type:

dict