首页 > 解决方案 > Metamask eth_requestAccounts 不适用于 localhost:3000

问题描述

我尝试在 localhost:3000 和 localhost:3001 上启动相同的 react 应用程序。当我执行

   const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });

在浏览器控制台中,或在我的 react 应用程序中运行它,在后者中一切正常。但是在前者(3000)中,metamask没有弹出连接提示,但它仍然可以获取地址。

有人知道为什么会这样吗?

标签: web3metamask

解决方案


推荐阅读