Failed to login with email passwordless

  • SDK Version(package.json):
    @web3auth/auth”: “^10.4.2”,
    @web3auth/modal”: “^10.0.3”,
  1. Developing on localhost
  2. Enter email address to login in web3auth login modal
  3. Error message “Something went wrong, error code: E002” raised in login modal
  4. In devtool, POST https://api.web3auth.io/passwordless-service/api/v3/auth/passwordless/start failed with response {“success”:false,“message”:“Invalid origin”,“error_code”:“E002”}
export const web3AuthOptions: Web3AuthOptions = {
  clientId: clientId,
  enableLogging: true,
  web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
  modalConfig: {
    connectors: {
      [WALLET_CONNECTORS.AUTH]: {
        label: "auth",
        loginMethods: {
          google: {
            name: "google login",
            authConnectionId: process.env.NEXT_PUBLIC_WEB3AUTH_GOOGLE_AUTH_ID,
            groupedAuthConnectionId: process.env.NEXT_PUBLIC_WEB3AUTH_GOOGLE_GROUP_AUTH_ID,
          },
          email_passwordless: {
            name: "email passwordless login",
            authConnectionId: process.env.NEXT_PUBLIC_WEB3AUTH_EMAIL_AUTH_ID,
            groupedAuthConnectionId: process.env.NEXT_PUBLIC_WEB3AUTH_EMAIL_GROUP_AUTH_ID,
          },
        },
        showOnModal: true,
      },
    },
  },

Thanks for sharing the detailed information and code snippet! Here’s a summary of your issue for the support team:


Issue Summary

  • SDK Used: Web3Auth Plug and Play (PnP) Web SDK

  • SDK Versions:

    • @web3auth/auth: ^10.4.2
    • @web3auth/modal: ^10.0.3
  • Platform: React (on localhost)

  • Login Method: Email Passwordless

  • Web3Auth Network: SAPPHIRE_DEVNET

  • Error:

    • Message: “Something went wrong, error code: E002”
    • DevTools:
      • Failing endpoint: POST https://api.web3auth.io/passwordless-service/api/v3/auth/passwordless/start
      • Response: {"success":false,"message":"Invalid origin","error_code":"E002"}
  • Configuration Snippet:

    • Using modalConfig with email_passwordless login method and custom authConnectionId/groupedAuthConnectionId from environment variables.

Analysis & Next Steps

The error Invalid origin (E002) typically means your current domain (in this case, localhost) is not whitelisted for passwordless authentication in your Web3Auth Dashboard project settings.

Solution:

  1. Whitelist localhost in Web3Auth Dashboard:

    • Go to your Web3Auth Dashboard.
    • Select your project.
    • In the “Whitelisted URLs” section, add:
      • http://localhost:3000
      • http://localhost:5173
      • Or any other port you are using for local development.
    • Save changes and try again.
  2. Reference:


If the issue persists:

  • Double-check that the authConnectionId and groupedAuthConnectionId are correct and correspond to your dashboard configuration.
  • Please provide a screenshot of your “Whitelisted URLs” in the dashboard if you still see the error after updating.

Let us know if whitelisting your localhost resolves the issue, or if you need further assistance!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.