# \[Archive\] Bug report in @web3auth/torus-evm-adapter

**URL:** <https://builder.metamask.io/t/archive-bug-report-in-web3auth-torus-evm-adapter/2252>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [December 12, 2022, 5:52pm UTC](https://builder.metamask.io/t/archive-bug-report-in-web3auth-torus-evm-adapter/2252 "2022-12-12T17:52:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![githubdiscussions](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@githubdiscussions](https://builder.metamask.io/u/githubdiscussions)\
**Post date:** [December 12, 2022, 5:52pm UTC](https://builder.metamask.io/t/archive-bug-report-in-web3auth-torus-evm-adapter/2252/1 "2022-12-12T17:52:28Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **githubdiscussions** on 12/12/2022.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

[web3auth-web/packages/adapters/torus-evm-adapter/src/torusWalletAdapter.ts](https://github.com/Web3Auth/web3auth-web/blob/28fafd3cb1aea476ecb5e6a740dc0defe27864fd/packages/adapters/torus-evm-adapter/src/torusWalletAdapter.ts#L113)

Line 113 in [28fafd3](https://builder.metamask.io/Web3Auth/web3auth-web/commit/28fafd3cb1aea476ecb5e6a740dc0defe27864fd)

```
    <tbody><tr class="border-0">
      <td id="L113" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="113"></td>
      <td id="LC113" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">const</span> <span class="pl-kos">{</span> chainId <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-smi">this</span><span class="pl-kos">.</span><span class="pl-c1">torusInstance</span><span class="pl-kos">.</span><span class="pl-c1">provider</span><span class="pl-kos">;</span> </td>
    </tr>
</tbody></table>

```

It should be

```
const chainId = this.torusInstance.provider.chainId;

```

Because of this bug, torus asks for chain switch confirmation **every time** the user refreshes browser (i.e. when `web3auth.init()` is called)  
[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/5/541ccc2d5f0a031e303749a75091d935fd4aba57.jpeg)](https://user-images.githubusercontent.com/28793091/207118381-fe03adec-3b83-4da2-92b8-7e640d3a4055.png)

### How to reproduce

- Go to [https://app.vrynt.io/login](https://app.vrynt.io/login)
- Click `SIGN IN WITH...` button
- Log in with google
  - You will be redirected to [https://app.vrynt.io/discover](https://app.vrynt.io/discover)

- Reload the page
  - Observe that it asks for chain switch confirmation

### Web3auth init code
\<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="export function getAVAXChainConfig(): CustomChainConfig { return { displayName: config.chainDisplayName, chainNamespace: CHAIN\_NAMESPACES.EIP155, chainId: config.chainId, rpcTarget: config.rpcUrl, blockExplorer: config.blockExplorerUrl, ticker: "AVAX", tickerName: "Avalanche", }; }

const web3auth = new Web3AuthCore({  
clientId: config.web3AuthClientId,  
chainConfig: getAVAXChainConfig(),  
});  
const torusAdapter = new TorusWalletAdapter({  
sessionTime: 86400 \* 7,  
});  
web3auth.configureAdapter(torusAdapter);  
await web3auth.init();"\>

```
export function getAVAXChainConfig(): CustomChainConfig {
return {
displayName: config.chainDisplayName,
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: config.chainId,
rpcTarget: config.rpcUrl,
blockExplorer: config.blockExplorerUrl,
ticker: “AVAX”,
tickerName: “Avalanche”,
};
}

```

  
  
 Originally posted by: [softcheetah](https://github.com/softcheetah)  
  
 Check the discussion at: [https://github.com/orgs/Web3Auth/discussions/1055](https://github.com/orgs/Web3Auth/discussions/1055)

---

<div class="post-metadata">

**Author:** ![githubdiscussions](https://avatars.discourse-cdn.com/v4/letter/g/13edae/32.png) [@githubdiscussions](https://builder.metamask.io/u/githubdiscussions)\
**Post date:** [December 19, 2022, 5:16am UTC](https://builder.metamask.io/t/archive-bug-report-in-web3auth-torus-evm-adapter/2252/2 "2022-12-19T05:16:08Z")

</div>

This should be fixed in v4.0.0  
Pls update

  
   
 Originally posted by: [chaitanyapotti](https://github.com/chaitanyapotti)
