xbox.webapi.authentication.xal module

Xbox Authentication Library

Authenticate with Windows Live Server and Xbox Live (used by mobile Xbox Apps)

class xbox.webapi.authentication.xal.XALManager(session, device_id, app_params, client_params)[source]

Bases: object

Parameters:
async static get_title_endpoints(session)[source]
Parameters:

session (AsyncClient) –

Return type:

TitleEndpointsResponse

async request_device_token()[source]
Return type:

XADResponse

async exchange_code_for_token(authorization_code, code_verifier)[source]
Parameters:
  • authorization_code (str) –

  • code_verifier (str) –

Return type:

OAuth2TokenResponse

async refresh_token(refresh_token_jwt)[source]
Parameters:

refresh_token_jwt (str) –

Return type:

Response

async request_sisu_authentication(device_token_jwt, code_challenge, state)[source]

Request Sisu authentication URL

Response holds authentication URL that needs to be called by the user in webbrowser

Returns:

Tuple of (authentication response, sisu session id)

Parameters:
  • device_token_jwt (str) –

  • code_challenge (str) –

  • state (str) –

Return type:

Tuple[SisuAuthenticationResponse, str]

async do_sisu_authorization(sisu_session_id, access_token_jwt, device_token_jwt)[source]

Sisu authorization

Returns:

Response with device-/title-/user-tokens

Parameters:
  • sisu_session_id (str) –

  • access_token_jwt (str) –

  • device_token_jwt (str) –

Return type:

SisuAuthorizationResponse

async xsts_authorization(device_token_jwt, title_token_jwt, user_token_jwt, relying_party)[source]

Request additional XSTS tokens for specific relying parties

Parameters:
  • device_token_jwt (str) –

  • title_token_jwt (str) –

  • user_token_jwt (str) –

  • relying_party (str) –

Return type:

XSTSResponse

async auth_flow(user_input_cb)[source]

Does the whole XAL/Sisu authentication flow

Parameters:

user_input_cb (Callable[[str], str]) – User callback which takes args: (auth_url: str) and returns the redirect URL (str)

Returns:

Sisu authorization response with all tokens

Return type:

SisuAuthorizationResponse