Skip to main content

grants.auto_login

User Objects​

class User(BaseModel)

A user model

StoredUser Objects​

class StoredUser(BaseModel)

A wrapping cl

UserStore Objects​

@runtime_checkable
class UserStore(Protocol)

A protocol for a user store

This protocol is implemented by the user store. It can be used to type hint a user store. This is used by the AutoLoginGrant to store the user.

aget_default_user​

async def aget_default_user() -> Optional[StoredUser]

Gets the default user

Returns​

Optional[StoredUser] A stored user, with the token and the user

aput_default_user​

async def aput_default_user(user: Optional[StoredUser]) -> None

Stores the default user

Parameters​

user : Optional[StoredUser] A stored user, with the token and the user, if None, the user should be deleted

AutoLoginWidget Objects​

@runtime_checkable
class AutoLoginWidget(Protocol)

A protocol for a login widget

This protocol is implemented by the login widget. It can be used to type hint a login widget. This is used by the AutoLoginGrant to show the login widget and ask the user if they want to save the user.

ashould_we_save​

async def ashould_we_save(store: StoredUser) -> bool

Should ask the user if we should save the user

AutoLoginGrant Objects​

class AutoLoginGrant(BaseGrant)

A grant that uses a Qt login screen to authenticate the user.

The user is presented with a login screen that allows them to select a user from a list of previously logged in users. If the user is not in the list, they can click a button to start the login flow.

store​

this is the login widget (protocol)

widget​

this is the login widget (protocol)

grant​

The grant to use for the login flow.

afetch_token​

async def afetch_token(request: TokenRequest) -> Token

Fetches the token

This function will only delegate to the grant if the user has not previously logged in (aka there is no token in the storage) Or if the force_refresh flag is set.

Arguments:

  • force_refresh bool, optional - description. Defaults to False.

Raises:

  • e - description

Returns:

  • Token - description

Config Objects​

class Config()

Pydantic config