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. Additionally, it standardizes error handling by storing error messages, allowing for seamless manipulation across the app. 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
methodjj
(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
errorMessage
A read-only reactive string for storing the error message
clearErrorMessage
A function that clears the error message