Skip to content

Better error handling for local provider #952

Open
@simon-ccoms

Description

@simon-ccoms

Describe the feature

There is no documentation on how to handle errors from external APIs when signing in using the local provider.

How would you implement this?

The only way I've managed to implement this is to use the following code. I'm not sure if there's any other way.

try {
    await signIn(
      {email: values.email, password: values.password},
      {callbackUrl: "/"}
    );
  } catch (error) {
    setFieldError("password", error?.response._data.detail);
    setErrors(error?.response._data);
  }

Additional information

  • Would you be willing to help implement this feature?

Provider

  • AuthJS
  • Local
  • Refresh
  • New Provider

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAn improvement that needs to be addedp3Minor issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions