Authenticator
Authenticates the PowerSync SDK against a PowerSync service, allowing it to download changes.
Extends
Methods
invalidateCredentials()?
optional invalidateCredentials(): void;
Invoked by the SDK when the PowerSync service has rejected credentials previously returned by Authenticator.resolveCredentials.
Subsequent calls to Authenticator.resolveCredentials should return new credentials in this case.
Returns
void
postCheckpointRequest()?
optional postCheckpointRequest(
clientId,
requestId,
signal?): Promise<string>;
Posts a client-generated checkpoint request to the backend and returns the effective checkpoint request state.
This method is optional. It only needs to be implemented when the selected CheckpointMode is requests
and asynchronous backend uploads
are used. In any other case, this method should not be present on backend connectors.
Parameters
| Parameter | Type | Description |
|---|---|---|
clientId | string | The PowerSync client ID for the current device. |
requestId | string | The client-generated checkpoint request ID (a positive 64-bit integer encoded as a string). |
signal? | AbortSignal | An optional abort signal that completes when the checkpoint is no longer necessary. |
Returns
Promise<string>
Inherited from
PostCustomCheckpoints.postCheckpointRequest
resolveCredentials()
resolveCredentials(options): Promise<string>;
Obtain a token used to authenticate against a PowerSync service.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | ResolveCredentialsOptions | Options, including an abort signal completing when the SDK is no longer interested in these credentials. Supported authenticators can reject the promise with the AbortSignal.reason when aborted. |
Returns
Promise<string>
A promise resolving to PowerSync credentials. It may reject when credentials could not be resolved.