Skip to main 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_tokenasync

dehydrate_token(saved_token: str)

Restore token state from previously persisted token data.

Parameters:

  • saved_token (str) - Serialized token payload.

get_authorization_data

get_authorization_data()

Build authorization URL and state for starting auth flow.

Returns:

  • tuple[str, str] - A tuple containing authorization URL and generated state value.

get_tokenasync

get_token()

Return the current token, refreshing it when needed.

Returns:

  • Any - Current authorization token object.

request_tokenasync

request_token(code: str)

Exchange authorization code for access/refresh token data.

Parameters: