docs
  1. Features
  2. Login & Registration
  3. Composables

Composables

The Login and Registration feature provides a single composable that centralizes the logic for core authentication flows, such as login, login with an IDP, guest login, registration, password reset, password update via hash, and logout. Furthermore, it integrates tracking for each flow, capturing successful and unsuccessful attempts.

useAuthentication

A composable for authentication actions and data manipulation. In addition to interacting with authentication, it tracks, handles errors, and displays successful toast messages.

Parameters

event

(Required) Authentication event type, which also distinguishes which flow is initiated

method

(Optional) Authentication type method. Defaults to email

Returns

login

An async function that handles the authentication process for a regular user

loginIDP

An async function that handles login through an identity provider (IDP)

guestLogin

An async function that handles the authentication process for a guest user.

register

An async function that handles registering the user

forgotPassword

An async function that handles the password recovery process for a specific user and returns boolean whether a response is success or not

resetPasswordByHash

An async function that handles resetting the password using a hash

logout

An async function that handles logging out the user

isSubmitting

A read-only reactive boolean that indicates whether each of the actions mentioned above is currently in the process of being submitted

authenticated

A function that is called when authentication succeeds

messageForEvent

Map an AuthTrackingEvent to a localized message