It can't redirect my domain

  • SDK Version: nomodal 7.1.2
  • Platform: vue
  • login: google
  • env: dev

Our previous test domain name was working properly, but today I added a new test domain name and the update domain name on the dashboard. The user still prompts errors during authorization.


@donut33.social As per the error message, your app has been configured with the web3AuthNetwork parameter for another environment while the clientId you are using belongs to a project on sapphire_devnet.

Please try changing the web3AuthNetwork parameter to sapphire_devnet in your code and let me know if it works for you.

Yes, I setted sapphire_devnet. The code is the same except the redirect link of my two test-ui. But the first one is work the next one is blocked.

Please share your entire code

export const BASE_URL = 'https://test-ui.dnt.social/'

const redirectUrl = BASE_URL + 'login';

const clientId = import.meta.env.VITE_CLIEND_ID;
const chainConfig = {
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: "0x2105",
    displayName: "Base",
    blockExplorer: "https://basescan.org",
    ticker: "ETH",
    tickerName: "Ethereum",
    rpcTarget: "https://mainnet.base.org/"
}

const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
    config: {
        chainConfig
    }
})

const openloginAdapter = new OpenloginAdapter({
    privateKeyProvider: ethereumPrivateKeyProvider,
    loginSettings: {
        mfaLevel: 'none'
    },
    adapterSettings: {
        uxMode: 'redirect',
        redirectUrl,
        replaceUrlOnRedirect: true,
        loginConfig: {
            typeOfLogin: 'goolge'
        },
        sessionTime: 86400 * 7,
        whiteLabel: {
            appName: 'Donut',
            appUrl: 'https://test-ui.dnt.social',
            logoLight: 'https://cdn.wherein.mobi/donut/donut-logo.jpg',
            logoDark: 'https://cdn.wherein.mobi/donut/donut-logo.jpg',
            defaultLanguage: 'en',
            mode: 'dark',
            useLogoLoader: true
        }
    }
})

export let web3auth;
let inited = false;
let initing = false;

export function web3AuthInited() {
    return inited;
}

export const web3AuthInit = async () => {
    try {
        if (inited) {
            return web3auth;
        }
        if (initing) return;
        initing = true;
        web3auth = new Web3AuthNoModal({
            clientId,
            chainConfig,
            web3AuthNetwork: 'sapphire_devnet'
        })
        web3auth.configureAdapter(openloginAdapter);
        console.log(1, web3auth.status)
        await web3auth.init();
        inited = true;
        initing = false;
        console.log(2, web3auth.status)
    } catch (error) {
        console.log(33, error)
    }
}

export const loginGoogle = async () => {
    await web3AuthInit();
    let provider;
    if (!web3auth.connected) {
        provider = await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
            loginProvider: 'google'
        })
    }else {
        provider = web3auth.provider;
    }
    try{
        const ethersP = new ethers.BrowserProvider(provider);
        const signer = await ethersP.getSigner();
        return await signer.getAddress();
    }catch(e) {
        console.log(4, e)
        return;
    }
}

Please share the screenshot of your project from the dashboard as well.


Can you remove the trailing / here so the URL is only

https://test-ui.dnt.social

Correct the spelling to ‘google’

Sorry for the typo.
I have correct it. But it still fail, the code is below now:

const BASE_URL = 'https://test-ui.dnt.social'
const redirectUrl = BASE_URL + '/login';

const clientId = import.meta.env.VITE_CLIEND_ID;
const chainConfig = {
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: "0x2105",
    displayName: "Base",
    blockExplorer: "https://basescan.org",
    ticker: "ETH",
    tickerName: "Ethereum",
    rpcTarget: "https://mainnet.base.org/"
}

const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({
    config: {
        chainConfig
    }
})

const openloginAdapter = new OpenloginAdapter({
    privateKeyProvider: ethereumPrivateKeyProvider,
    loginSettings: {
        mfaLevel: 'none'
    },
    adapterSettings: {
        uxMode: 'redirect',
        redirectUrl,
        replaceUrlOnRedirect: true,
        loginConfig: {
            typeOfLogin: 'google'
        },
        sessionTime: 86400 * 7,
        whiteLabel: {
            appName: 'Donut',
            appUrl: 'https://test-ui.dnt.social',
            logoLight: 'https://cdn.wherein.mobi/donut/donut-logo.jpg',
            logoDark: 'https://cdn.wherein.mobi/donut/donut-logo.jpg',
            defaultLanguage: 'en',
            mode: 'dark',
            useLogoLoader: true
        }
    }
})

export let web3auth;
let inited = false;
let initing = false;

export function web3AuthInited() {
    return inited;
}

export const web3AuthInit = async () => {
    try {
        if (inited) {
            return web3auth;
        }
        if (initing) return;
        initing = true;
        web3auth = new Web3AuthNoModal({
            clientId,
            chainConfig,
            web3AuthNetwork: 'sapphire_devnet'
        })
        web3auth.configureAdapter(openloginAdapter);
        console.log(1, web3auth.status)
        await web3auth.init();
        inited = true;
        initing = false;
        console.log(2, web3auth.status)
    } catch (error) {
        console.log(33, error)
    }
}

export const loginGoogle = async () => {
    await web3AuthInit();
    let provider;
    if (!web3auth.connected) {
        provider = await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
            loginProvider: 'google'
        })
    }else {
        provider = web3auth.provider;
    }
    try{
        const ethersP = new ethers.BrowserProvider(provider);
        const signer = await ethersP.getSigner();
        console.log(3, signer.address);
        return await signer.getAddress();
    }catch(e) {
        console.log(4, e)
        return;
    }
}```

@donut33.social Can you refer to this example here for Vue as a guide for your code to implement the same. Also, ensure you upgrade all your packages to the latest version 7.2.0.

I found the issue. It’s my fault, the key is end with the char ‘;’, It’s wrong

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