server
Server connection and authentication.
4 functions / 2 types
Index
| Function | Description |
|---|---|
| authenticate | Authenticate the client using the given strategy. |
| get_user_details | Execute the get_user_details statement. |
| logout | Execute the logout statement. |
| set_url | Set the URL of the fdk server the client connects to. |
| Type | Description |
|---|---|
| AuthStrategy | The authentication strategy used by Authenticate. |
| AuthStrategyKind | How the application proves who it is. |
authenticate
def authenticate(
*,
strategy: types.server.AuthStrategy,
_transaction_id: str | None = None
) -> NoneAuthenticate the client using the given strategy.
The server URL must already be configured via SetServerUrl. Available strategies:
session-storage:keyis a browser session-storage key holding the access token. Only supported onwasm32.transparent:keyis 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) -> strExecute 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) -> NoneExecute 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) -> NoneSet 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.