Skip to main content

Function: useAuth()

useAuth(options): UseAuthReturn

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

useAuth — login, registration, and forgot-password flows.

Parameters

options

UseAuthOptions

see UseAuthOptions.

Returns

UseAuthReturn

loading/error state plus async auth actions — see UseAuthReturn.

Remarks

GraphQL integration: services are built per-call via createServices(graphqlClient). login calls services.login.login() (LoginService) then services.user.getViewer() (UserService) to fetch the Contact/Customer; the JWT is set as an in-memory Bearer header via graphqlClient.updateConfig() only — never persisted (cross-reload auth relies on an httpOnly cookie). registerContact runs company.createCompanyuser.registerContact → implicit loginaddress.createCompanyAddressuser.triggerContactSendWelcomeEmailEvent. registerCustomer runs user.registerCustomerloginaddress.createCustomerAddressuser.triggerCustomerSendWelcomeEmailEvent, re-fetching the viewer afterward. When autoLogin is false the session is dropped via clearAccessToken(). forgotPassword calls user.sendPasswordResetEmail().