Authentication#
- async minecraft.auth.get_access_token(token)#
Exchanges a Microsoft access token for a Minecraft access token.
- 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:
- Raises:
RuntimeError – msal is not installed.
AuthenticationError – Authentication failed.
- 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: