Cannot call switchNetwork, as it does not exist on connector type "web3Auth"

I have a strange issue with my site. I have implemented web3Auth, and it performs as expected. I have also implemented the network switching component from the ethereum boilerplate. When i first authenticate with web3Auth (using Metamask), my home screen is displayed, and I am connected to the ethereum mainnet.

If I try to switch networks, I get the following error:

Cannot call switchNetwork, as it does not exist on connector type "web3Auth"

If i refresh my browser, everything works as expected. I can switch networks without any errors. I only get this error when i try to switch networks the first time. After refresh, everything is beautiful.

Scratching my head on this problem.

For those in the future, the solution was change web3Auth to web3auth in the provider parameter for the authenticate function

web3auth as suggested in the previous answer does not work. still with the latest react-moralis web3Auth is accepted value. Does anyone have any other solution to this?

switchNetwork is only meant to work when MetaMask is used.

What he did was end up using the default authenticate connector for MetaMask (which happens if you don’t specify any provider or specify an incorrect one), so he’s not using Web3Auth in that authenticate.