Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.48 KB

authentication.rst

File metadata and controls

52 lines (34 loc) · 1.48 KB

Authentication

.. currentmodule:: minecraft.authentication

The authentication module contains functions and classes to facilitate interfacing with Mojang's Yggdrasil authentication service.

Logging In

The most common use for this module in the context of a client will be to log in to a Minecraft account. The first step to doing this is creating an instance of the AuthenticationToken class after which you may use the authenticate method with the user's username and password in order to make the AuthenticationToken valid.

.. autoclass:: AuthenticationToken
    :members: authenticate

Upon success, the function returns True, on failure a YggdrasilError is raised. This happens, for example if an incorrect username/password is provided or the web request failed.

.. autoexception:: YggdrasilError
    :members:


Arbitary Requests

You may make any arbitary request to the Yggdrasil service with the _make_request method passing in the AUTH_SERVER as the server parameter.

.. automodule:: minecraft.authentication
        :members: AUTH_SERVER

.. autofunction:: _make_request


Example Usage

An example of making an arbitary request can be seen here:

payload = {'username': username,
           'password': password}

authentication._make_request(authentication.AUTH_SERVER, "signout", payload)