client.connect() for headless and
Customer API integrations. It handles authentication only, with no
payment-method setup or KYC steps. When the customer finishes, the SDK
decrypts the returned credentials and primes the client so that subsequent SDK
calls are authenticated automatically.
Call
client.getConnection()
first. The connection check primes the client with the token the Auth frame
needs. If you call setupAuth() without a prior connection check that
resolved with status: "connectionRequired", it returns a
configurationError.Setup auth
The promise returned by
client.setupAuth() resolves after the customer
completes the auth flow (or closes it, or an error ends it). Track flow
progress — including the moment the UI is ready to show — through onEvent,
not by awaiting the promise.Parameters
AuthEvent
onEvent receives events as the auth flow progresses. Use event.kind to
decide how to handle each event.
AuthEventError
The error event payload comes from the underlying auth frame. It is
discriminated by code.
Check
event.payload.status before you treat "complete" as a successful
sign-in. An unavailable connection carries no credentials and can’t be used.
Use its optional reason to choose the message you show, then offer another
payment option instead of continuing. See
Unavailable.Result
client.setupAuth() returns a Result<AuthFrame, SetupAuthError>.
Result envelope
Result<AuthFrame, SetupAuthError>
AuthFrame
SetupAuthError
TS Definitions
TS Definitions
types.ts