kshitijp
11/10/2023, 8:21 AMsignIn function provided by supertokens-web-js/recipe/emailpassword on a vite react frontend like so 
ts
import { signIn } from "supertokens-web-js/recipe/emailpassword";
...
const response = await signIn({
        formFields: [
          {
            id: "email",
            value: email,
          },
          {
            id: "password",
            value: password,
          },
        ],
      });
      if (response.status === "FIELD_ERROR") {
        response.formFields.forEach((formField) => {
          if (formField.id === "email") {
            // Email validation failed (for example incorrect email syntax).
            form.setError("email", { message: formField.error, type: "validate" });
          }
        });
      } else if (response.status === "WRONG_CREDENTIALS_ERROR") {
        form.setError("root", { message: "The given email/password doesn't exist." });
      } else {
        // navigate(searchParams.get("redirectToPath") ?? "/");
        alert("Logged in");
      }
Would really appreciate help on this issuerp_st
11/10/2023, 2:13 PMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by