Validation failed error while passwordles email


I got this error in passwordless email login

Update: I got this error now

hi @goktugkoksal ,

Can you share with us more information ?

  • SDK Version(package.json):
  • Platform:
  • Browser Console Screenshots:
  • If the issue is related to Custom Authentication, please include the following information (optional):
    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken (JWT):

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

Hi @TomTom ,

const clientId = process.env.WEB3AUTH_CLIENT_ID;

const chainConfig = {
    chainNamespace: "eip155",
    chainId: "0x89", // hex of 137, polygon mainnet
    rpcTarget: process.env.POLYGON_MAINNET_URL,

    displayName: "Polygon Mainnet",
    blockExplorerUrl: "https://polygonscan.com",
    ticker: "MATIC",
    tickerName: "MATIC",
    logo: "https://cryptologos.cc/logos/polygon-matic-logo.png",
};

const privateKeyProvider = new EthereumPrivateKeyProvider({
    config: { chainConfig },
});

const openloginAdapterEN = new OpenloginAdapter({
    adapterSettings: {
        uxMode: "popup",
        whiteLabel: {
            appName: "CopeTract",
            appUrl: "https://www.copetract.com/",
            logoLight: "/assets/logo.png",

            defaultLanguage: "en", // en, de, ja, ko, zh, es, fr, pt, nl
            mode: "light", // whether to enable dark mode. defaultValue: false
            theme: {
                primary: "#5842bc",
            },
        },
    },
    privateKeyProvider,
});

const openloginAdapterTR = new OpenloginAdapter({
    adapterSettings: {
        uxMode: "popup",
        whiteLabel: {
            appName: "CopeTract",
            appUrl: "https://www.copetract.com/",
            logoLight: "https://www.copetract.com/assets/logo.png",
            defaultLanguage: "tr", // en, de, ja, ko, zh, es, fr, pt, nl
            mode: "light", // whether to enable dark mode. defaultValue: false
            theme: {
                primary: "#5842bc",
            },
        },
    },
    privateKeyProvider,
});

const web3authen = new Web3Auth({
    uiConfig: {
        appName: "CopeTract",
        appUrl: "https://www.copetract.com/",

        theme: {
            primary: "#5842bc",
        },
        mode: "light",
        logoLight: "/assets/logo.png",
        loginMethodsOrder: [
            "google",
            "apple",
            "linkedin",
            "twitter",
            "facebook",
            "reddit",
            "github",
            "discord",
            "twitch",
            "line",
            "kakao",
            "weibo",
            "wechat",
            "email_passwordless",
        ],
        displayErrorsOnModal: false,

        defaultLanguage: "en", // en, de, ja, ko, zh, es, fr, pt, nl
        loginGridCol: 3,
        primaryButton: "externalLogin", // "externalLogin" | "socialLogin" | "emailLogin"
    },

    clientId,
    chainConfig,
    web3AuthNetwork: "sapphire_mainnet",
});

const web3authtr = new Web3Auth({
    uiConfig: {
        appName: "CopeTract",
        appUrl: "https://www.copetract.com/",

        theme: {
            primary: "#5842bc",
        },
        mode: "light",
        logoLight: "/assets/logo.png",
        loginMethodsOrder: [
            "google",
            "apple",
            "linkedin",
            "twitter",
            "facebook",
            "reddit",
            "github",
            "discord",
            "twitch",
            "line",
            "kakao",
            "weibo",
            "wechat",
            "email_passwordless",
        ],
        displayErrorsOnModal: false,

        defaultLanguage: "tk", // en, de, ja, ko, zh, es, fr, pt, nl
        loginGridCol: 3,
        primaryButton: "externalLogin", // "externalLogin" | "socialLogin" | "emailLogin"
    },

    clientId,
    chainConfig,
    web3AuthNetwork: "sapphire_mainnet",
});

web3authen.configureAdapter(openloginAdapterEN);
web3authtr.configureAdapter(openloginAdapterTR);

export default function SignerProvider({ children, language }) {
    const [provider, setProvider] = useState("");

    const [ethersProvider, setEthersProvider] = useState();
    const [ethersSigner, setEthersSigner] = useState();
    const [address, setAddress] = useState();
    const [chainId, setChainId] = useState();
    const [lng, setLng] = useState();

    const [loggedIn, setLoggedIn] = useState(false);

    useEffect(() => {
        setLng(localStorage.getItem("language"));
        if (lng !== "" && lng !== undefined) {
            web3AuthInit(lng);
        }
    }, [lng]);

async function web3AuthInit(lng) {
        try {
            console.log("hey");
            let web3auth;

            if (lng == "en") {
                web3auth = web3authen;
            } else {
                web3auth = web3authtr;
            }

            await web3auth.initModal({
                modalConfig: {
                    [WALLET_ADAPTERS.OPENLOGIN]: {
                        label: "openlogin",
                        loginMethods: {
                            sms_passwordless: {
                                name: "sms_passwordless",
                                showOnModal: false,
                            },
                        },
                    },
                },
            });

            setProvider(web3auth.provider);

            if (web3auth.connected) {
                setLoggedIn(true);

                const ethersProvider = new ethers.providers.Web3Provider(
                    web3auth.provider
                );
                const ethersSigner = ethersProvider.getSigner();
                const chainId = await ethersProvider.getNetwork();
                const address = await ethersSigner.getAddress();

                setEthersProvider(ethersProvider);
                setEthersSigner(ethersSigner);
                setAddress(address);
                setChainId(chainId);
            }
        } catch (error) {
            console.error(error);
        }
    }

const login = async (lng) => {
        try {
            let web3auth;

            if (lng == "en") {
                web3auth = web3authen;
            } else {
                web3auth = web3authtr;
            }

            const web3authProvider = await web3auth.connect();
            setProvider(web3authProvider);

            const ethersProvider = new ethers.providers.Web3Provider(provider);
            const ethersSigner = ethersProvider.getSigner();
            const chainId = await ethersProvider.getNetwork();
            const address = await ethersSigner.getAddress();

            if (ethersProvider && ethersSigner) {
                setEthersProvider(ethersProvider);
                setEthersSigner(ethersSigner);
                setAddress(address);

                setChainId(chainId);
            }

            if (web3auth.connected) {
                setLoggedIn(true);
                localStorage.setItem("network", "polygon");
                localStorage.setItem("loggedIn", "true");

                let userInfo = await web3auth.getUserInfo();
                await isUserNew(address, userInfo);
            }
        } catch (error) {
            if (error.message == "User closed the modal") {
            } else {
                console.log(error);
            }
        }
    };

Its a little bit urgent thanks for understanding ,
Best regards Goktug.

@goktugkoksal I was able to complete the passwordless email validation and landed on the below screen to complete the registraion:

image

I see you are using an Outlook Email . Can you check with any other email and let me know if you face the issue?

@vjgee
I checked with gmail - outlook- hotmail - companymail
Just gmail working.
Why is it happening and how to fix it

Are you not getting the verificaiton email itself when using Outlook, Hotmail , etc…?

Nope I’m getting the error above

Thanks for confirming.

I have reported this to our Dev team and will get back with further updates.

@vjgee
I got an update. Error only occurs with turkish language option

@goktugkoksal It appears you are using the incorrect language code for Turkish . Can you please change tk ro tr as the defaultLanguage for Turkish and it should resolve. Please ensure you upgrade to version 7.3.2 for modal SDK.

I upgrade version to 7.3.2 and change defaultLanguage to tr
but it doesnt resolve

Please share your package.json file

{
  "name": "copetract",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@coinbase/wallet-sdk": "^3.7.1",
    "@iconify/react": "^4.0.1",
    "@moonpay/moonpay-js": "^0.4.0",
    "@moonpay/moonpay-react": "^1.5.1",
    "@nomicfoundation/hardhat-toolbox": "^2.0.0",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "@openzeppelin/contracts": "^4.8.0",
    "@transak/transak-sdk": "^2.0.2",
    "@walletconnect/ethereum-provider": "^2.10.5",
    "@walletconnect/modal": "^2.6.2",
    "@walletconnect/web3-provider": "^1.8.0",
    "@web3auth/coinbase-adapter": "^7.3.1",
    "@web3auth/ethereum-provider": "^8.0.1",
    "@web3auth/modal": "^7.3.2",
    "@web3modal/ethereum": "^2.7.0",
    "@web3modal/react": "^2.7.0",
    "@web3modal/wagmi": "^3.3.2",
    "axios": "^1.4.0",
    "bootstrap": "^5.2.3",
    "date-fns": "^2.29.3",
    "dotenv": "^16.0.3",
    "draft-js": "^0.11.7",
    "ethers": "^5.7.2",
    "hardhat": "^2.12.4",
    "html2canvas": "^1.4.1",
    "html2pdf.js": "^0.9.0",
    "jquery": "^3.6.1",
    "jspdf": "^2.5.1",
    "next": "13.0.6",
    "nft.storage": "^7.0.0",
    "react": "^18.2.0",
    "react-datepicker": "^4.8.0",
    "react-dom": "^18.2.0",
    "react-draft-wysiwyg": "^1.15.0",
    "react-drag-drop-files": "^2.3.8",
    "react-select": "^5.7.0",
    "sweetalert2": "^11.6.15",
    "viem": "^1.19.3",
    "wagmi": "^1.4.7",
    "web3modal": "^1.9.10"
  }
}

It is definitely about turkish language support. I changed defaultLanguage options tr to de and now its working. just to help for spotting problem

it’s solved? if not

please try to update “@web3auth/modal”: “^8.0.1”, as you are using “@web3auth/ethereum-provider”: “^8.0.1”,

I updated @web3auth/modal to version 8.0.1 and it is still occurring

We have just reproduced the error in our servers and reported it.

We’ll let you know when it’s fixed.

Thank you very much. Im looking forward to it.
Best regards.

hi @goktugkoksal,

The error has already been corrected, could you confirm if it works well for you?