Skip to content

Authorization

Abstract authorization contract used by Flet authentication workflows.

Implementations provide OAuth-style authorization URL/state generation, token exchange, token hydration from persisted storage, and token retrieval.

Methods

  • dehydrate_token

    Restore token state from previously persisted token data.

  • get_authorization_data

    Build authorization URL and state for starting auth flow.

  • get_token

    Return the current token, refreshing it when needed.

  • request_token

    Exchange authorization code for access/refresh token data.

Methods#

dehydrate_token async #

dehydrate_token(saved_token: str) -> None

Restore token state from previously persisted token data.

Parameters:

  • saved_token (str) –

    Serialized token payload.

get_authorization_data #

get_authorization_data() -> tuple[str, str]

Build authorization URL and state for starting auth flow.

Returns:

  • tuple[str, str]

    A tuple containing authorization URL and generated state value.

get_token async #

get_token() -> Any

Return the current token, refreshing it when needed.

Returns:

  • Any

    Current authorization token object.

request_token async #

request_token(code: str) -> None

Exchange authorization code for access/refresh token data.

Parameters:

  • code (str) –

    Authorization code returned by provider redirect.