It failed when I call getSigner use ethers provider

I used ethers 6.8.0
web3auth 7.1.0
I connected to web3 auth, and sure the connected of web3auth is true.
I construct ethers provider like this:
const ethersP = new ethers.BrowserProvider(provider);
It’s ok now.
And I get the signer use:
const signer = await ethersP.getSigner(), It faild:

could not coalesce error (error={ “code”: -32603, “data”: { “cause”: null, “error”: { “code”: -32001, “message”: “rpc method is not allowed” }, “id”: “od3psl72orr”, “jsonrpc”: “2.0” }, “payload”: { “method”: “eth_requestAccounts”, “params”: [ ] } }, payload={ “method”: “eth_requestAccounts”, “params”: [ ] }, code=UNKNOWN_ERROR, version=6.8.1)

@donut33.social Could you please provide more information:

  1. Which SDK are you using
  2. Web3Auth Initialization and login code

Thank you for your feed back.
I use nomodal sdk
ethereum provider
openlogin adapter is google
login code is this:
export const web3AuthInit = async () => {
try {
await web3auth.init();
} catch (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) {
return;
}
}

The whole code:

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: 'http://localhost:5173/login',
        replaceUrlOnRedirect: true,
        loginConfig: {
            typeOfLogin: 'goolge'
        },
        sessionTime: 86400 * 700,
        whiteLabel: {
            appName: 'Donut',
            appUrl: 'https://test-ui.donut-social.xyz',
            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 const web3auth = new Web3AuthNoModal({
    clientId,
    chainConfig,
    web3AuthNetwork: 'sapphire_devnet'
})

web3auth.configureAdapter(openloginAdapter);

export const web3AuthInit = async () => {
    try {
        await web3auth.init();
    } catch (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{
        console.log(76, provider, web3auth.status, web3auth.connected)
        const ethersP = new ethers.BrowserProvider(provider);
        const signer = await ethersP.getSigner();
        return await signer.getAddress();
    }catch(e) {
        return;
    }
}

I use redirect uxMode
and auth Google then redirect back to my page, then I call the getSigner function, It failed

Hi, is there any solution?

Our team will review and update.

@donut33.social Could you ensure you are on the latest versions below:

@web3auth/openlogin-adapter”; 7.2.0
@web3auth/ethereum-provider”; 7.2.0
@web3auth/no-modal”; 7.2.0

Also, can you use ethers 6.7.1 instead of 6.8.0 and share your result.

I solved it. The web3auth instanse can’t be initial more than one time, otherwise it cann’t be used.

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