Main Components and Workflow
Endpoint Creation:
- An automated login endpoint is generated by selecting the authentication feature in the API settings of Twidget. This is the endpoint that will receive and process login credentials.
Page Configuration:
- Within the pages tab, users can create a new login page by selecting the previously created login endpoint. This links the frontend interface to the backend process, directing login data to the correct API endpoint.
User Interface Elements:
The generated login page includes:
Input fields for email and password.
Message blocks for displaying success or error notifications.
A login button to submit user credentials.
The page also includes variables managing UI state, reflecting login process status and user feedback.
Submission Handling:
- A predefined function is associated with the form submission event. This function is responsible for sending user inputs to the login endpoint and handling the received authentication token and potential error messages.
Token Management:
Upon successful authentication, the token received from the server is stored in local storage, enabling the application to authenticate requests made by the user in subsequent sessions.
A navigation command can be added to redirect users to a designated page after successful login, enhancing user experience.