Skip to main content

Interface: UseAuthReturn

Defined in: composables/react/useAuth.ts:161

State and auth actions returned by useAuth.

Properties​

createMagicToken​

createMagicToken: (input) => Promise<Result<MagicToken, string>>

Defined in: composables/react/useAuth.ts:175

Issues a magic token for a contact/customer (authenticated); its id is embedded in a magic-login link.

Parameters​

input​

MagicTokenCreateInput

Returns​

Promise<Result<MagicToken, string>>


error​

error: string | null

Defined in: composables/react/useAuth.ts:165

Last error message, or null.


forgotPassword​

forgotPassword: (email) => Promise<Result<void, string>>

Defined in: composables/react/useAuth.ts:189

Triggers a password-reset email for the given address.

Parameters​

email​

string

Returns​

Promise<Result<void, string>>


loading​

loading: boolean

Defined in: composables/react/useAuth.ts:163

true while a login or registration call is in flight.


login​

login: (email, password, onLoginSubmit?) => Promise<Result<AuthSuccess, string>>

Defined in: composables/react/useAuth.ts:167

Authenticates by email/password; pass onLoginSubmit to fully override the SDK login.

Parameters​

email​

string

password​

string

onLoginSubmit?​

(email, password) => Promise<Contact | Customer>

Returns​

Promise<Result<AuthSuccess, string>>


magicLogin​

magicLogin: (token) => Promise<Result<AuthSuccess, string>>

Defined in: composables/react/useAuth.ts:173

Passwordless login: exchanges a backend-issued magic token for a session (then loads the viewer).

Parameters​

token​

string

Returns​

Promise<Result<AuthSuccess, string>>


registerContact​

registerContact: (input, preferredLanguage?, autoLogin?) => Promise<Result<AuthSuccess, string>>

Defined in: composables/react/useAuth.ts:177

Registers a B2B contact (and optionally a company + addresses); autoLogin keeps the session.

Parameters​

input​

UseAuthRegisterContactInput

preferredLanguage?​

string

autoLogin?​

boolean

Returns​

Promise<Result<AuthSuccess, string>>


registerCustomer​

registerCustomer: (input, preferredLanguage?, autoLogin?) => Promise<Result<AuthSuccess, string>>

Defined in: composables/react/useAuth.ts:183

Registers a B2C customer (and optionally addresses); autoLogin keeps the session.

Parameters​

input​

UseAuthRegisterCustomerInput

preferredLanguage?​

string

autoLogin?​

boolean

Returns​

Promise<Result<AuthSuccess, string>>