mojang.api.auth.models

class mojang.api.auth.models.AuthenticatedUser(access_token: str, refresh_token: str)

Bases: ABC

Base class for every authenticated user

Parameters:
  • access_token (str) – The session token

  • refresh_token (str) – The refresh token

Variables:
  • name (str) – The user name

  • uuid (str) – The user uuid

  • is_legacy (bool) – Wether the account has migrated

  • is_demo (bool) – Wether the account is demo

  • skin (Skin) – The active user skin

  • skins (list[Skin]) – All the skins of the user

  • cape (Cape) – The active user cape

  • capes (list[Cape]) – All the capes of the user

  • name_change_allowed (bool) – Can the user change name

  • created_at (datetime.datetime) – When was the user created

property cape: Cape | None
property capes: list[Cape] | None
change_name(name: str)

Change user name. For more details checkout change_user_name()

Parameters:

name (str) – The new name

change_skin(path: str, variant: str | None = 'classic')

Change user skin. For more details checkout change_user_skin()

Parameters:
  • path (str) – The path to the skin, either local or remote

  • variant (str) – The variant of skin (default to ‘classic’)

abstract close()
property created_at: datetime.datetime | None
hide_cape()

Hide user cape. For more details checkout hide_user_cape()

property is_demo: bool
property is_legacy: bool
property name: str | None
property name_change_allowed: bool
abstract refresh()
reset_skin()

Reset user skin. For more details checkout reset_user_skin()

show_cape(cape_index: int = 0)

Show user cape. For more details checkout show_user_cape()

Parameters:

cape (int) – The index of the cape

property skin: Skin | None
property skins: list[Skin] | None
property uuid: str | None
class mojang.api.auth.models.MicrosoftAuthenticatedUser(access_token: str, refresh_token: str, oauth_client: msal.ClientApplication)

Bases: AuthenticatedUser

Class for user with a Microsoft account

close()

Close current session

refresh()

Refresh current session

class mojang.api.auth.models.MojangAuthenticationApp(client: msal.ClientApplication, redirect_uri: str)

Bases: object

property authorization_url: str

Returns the authorization url for Microsoft OAuth

get_session(code: str) MicrosoftAuthenticatedUser