Skip to content

server

Server connection and authentication.

4 functions / 2 types

Index

FunctionDescription
authenticateAuthenticate the client using the given strategy.
get_user_detailsExecute the get_user_details statement.
logoutExecute the logout statement.
set_urlSet the URL of the fdk server the client connects to.
TypeDescription
AuthStrategyThe authentication strategy used by Authenticate.
AuthStrategyKindHow the application proves who it is.

authenticate

def authenticate(
    *,
    strategy: types.server.AuthStrategy,
    _transaction_id: str | None = None
) -> None

Authenticate the client using the given strategy.

The server URL must already be configured via SetServerUrl. Available strategies:

  • session-storage: key is a browser session-storage key holding the access token. Only supported on wasm32.
  • transparent: key is ignored. Marks the application as authenticated without providing a token. Useful for integrations that inject the token some other way (e.g. cookies or service workers).

Both authentication and refresh go through this statement; the work of acquiring a token (e.g. via an OAuth2 flow) is expected to happen outside of the statement system.

Returns None.

strategy : AuthStrategy

The authentication strategy to use.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

get_user_details

def get_user_details(*, _transaction_id: str | None = None) -> str

Execute the get_user_details statement.

Returns str.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

logout

def logout(*, _transaction_id: str | None = None) -> None

Execute the logout statement.

Returns None.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

set_url

def set_url(*, url: str, _transaction_id: str | None = None) -> None

Set the URL of the fdk server the client connects to.

Inserts a ServerUrl resource that the login flow reads when authenticating. This replaces the per-environment URL helpers that previously selected the server at app startup.

Returns None.

url : str

The server URL, e.g. https://api.spatialdrive.io.

_transaction_id optional : str | None

Transaction to join. Omit to submit without an explicit transaction. Defaults to None.

AuthStrategy

AuthStrategy(*, kind: types.server.AuthStrategyKind, key: str)

The authentication strategy used by Authenticate.

kind : AuthStrategyKind

Which strategy to use, as an AuthStrategyKind i32 kind.

key : str

The session-storage key holding the access token (only for session-storage).

AuthStrategyKind

Enum

class AuthStrategyKind(IntEnum)

How the application proves who it is.

Values: SESSION_STORAGE = 0 key is a browser session-storage key holding the access token. Only supported on wasm32. TRANSPARENT = 1 key is ignored. The application is marked authenticated without a token.

SESSION_STORAGE = 0

key is a browser session-storage key holding the access token. Only supported on wasm32.

TRANSPARENT = 1

key is ignored. The application is marked authenticated without a token.