Supabase auth: display invalid credentials message on invalid login attempt

When a user makes an invalid login attempt, for example, with a wrong password, or an unregistered email address, I’d like to display the returned error message to them on the login screen.

For example, a user attempts to login as:

Then, this returns in console:

image

When that auth response is received, I’d like to display it to the user, as currently nothing is displayed, so it appears like the form is not working, which I’d like to avoid by showing this:

How can I catch that error and display the message to the user?

Ok, so I found the solution to this:

1. In your Login Workflow, toggle to the On Error mode, add a (Change variable value) action, and create a new Text Variable:

image

2. Add dummy data at the Login Form so that we can run a workflow test to simulate an invalid login attempt:

3. Run the workflow test to see the error:

image

4. Assign the error (Message) to the Text Variable from step 1:

5. Add a text Label to the login form, and bind it to the Text Variable:

Now, any type of error encountered during the login flow will be returned to the user.

Unregistered user, or wrong credentials, return this:

Blank login returns this:

3 Likes

Thanks to have taken time to post your answer :slight_smile:

1 Like