server
Server connection and authentication.
4 functions / 2 types
Index
| Function | Description |
|---|---|
| authenticate | Authenticate the client using the given strategy. |
| getUserDetails | Execute the getUserDetails statement. |
| logout | Execute the logout statement. |
| setUrl | 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
authenticate(args: { strategy: ServerAuthStrategy }, transactionId?: string): Promise<void>Authenticate 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 Promise<void>.
strategy : ServerAuthStrategy
The authentication strategy to use.
transactionId optional : string
getUserDetails
getUserDetails(transactionId?: string): Promise<string>Execute the getUserDetails statement.
Returns Promise<string>.
transactionId optional : string
logout
logout(transactionId?: string): Promise<void>Execute the logout statement.
Returns Promise<void>.
transactionId optional : string
setUrl
setUrl(args: { url: string }, transactionId?: string): Promise<void>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 Promise<void>.
url : string
The server URL, e.g. https://api.spatialdrive.io.
transactionId optional : string
AuthStrategy
The authentication strategy used by Authenticate.
key : string
The session-storage key holding the access token (only for session-storage).
kind : ServerAuthStrategyKind
Which strategy to use, as an AuthStrategyKind i32 kind.
AuthStrategyKind
Enum
How the application proves who it is.
SessionStorage = 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.