# \[Archive\] Error connecting using SFA SDK

**URL:** <https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [October 17, 2023, 12:39pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730 "2023-10-17T12:39:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharan](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sharan](https://builder.metamask.io/u/sharan)\
**Post date:** [October 17, 2023, 12:39pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/1 "2023-10-17T12:39:34Z")

</div>

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

* * *

When upgrading to the new SFA SDK, I am facing the following error. Any idea what it could mean?

```auto
fetchNodeDetails.esm.js:65 Uncaught (in promise) Error: Failed to fetch node details
    at T.getNodeDetails (fetchNodeDetails.esm.js:65:31)
    at async Lr.connect (Web3Auth.ts:219:47)
    at async loginWeb3Auth ((index):240:13)
    at async HTMLInputElement.action_1 ((index):647:29)

```

This happens at the connect step.

- SDK Version: 7.0.1
- Verifier Details:
  - Verifier Name: acmecore-iss2
  - JWKS Endpoint: [https://stg-acme.us.auth0.com/.well-known/jwks.json](https://stg-acme.us.auth0.com/.well-known/jwks.json)
  - Sample idToken(JWT): eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ikg5QWdjTnRGWGJWejBsZGQ2RXRQTSJ9.eyJnaXZlbl9uYW1lIjoiU2hhcmFuIiwiZmFtaWx5X25hbWUiOiJZYWxidXJnaSIsIm5pY2tuYW1lIjoic2hhcmFuIiwibmFtZSI6IlNoYXJhbiBZYWxidXJnaSIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NMWUt1NERJMFAta0tjZUc5Mld1dWZCV1M2VzAyenpVcVJ2RkhmcjJqbkg9czk2LWMiLCJsb2NhbGUiOiJlbiIsInVwZGF0ZWRfYXQiOiIyMDIzLTEwLTEzVDE4OjI3OjI3LjU1MVoiLCJlbWFpbCI6InNoYXJhbkBhY21lZGFvLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJpc3MiOiJodHRwczovL3N0Zy1hY21lLnVzLmF1dGgwLmNvbS8iLCJhdWQiOiJ0Q29Oc2xJVlVwNTJrU3pXZXJkanp1S0hndkxsQnlmWSIsImlhdCI6MTY5NzQ3MjMxNCwiZXhwIjoxNjk3NTA4MzE0LCJzdWIiOiJnb29nbGUtb2F1dGgyfDEwMTgzNjQ5NjM4ODk1OTY5MzMyOCIsInNpZCI6ImpvV3BUc3Fsc3J3WTNvUGZINkZKclcwcGx1R2Zud3VHIiwibm9uY2UiOiI3MTIwN2NiMTEwYjkwZDhiMmMzNGYwZTg3YjRmOWE0YSJ9.O1tagfFaTV84nCU-v2fIlQgT0Yg-EL3oa0cfFXlcwIrsYrzNcPcylZBMWRRxFGIhpxn3uFIgD5u17vIr4GbvnOVoZ6SAWmocTEvdVbpQtsevyCxPHikQR4itghU-VKxNg-y9PEpkho0Xd8tO05Iot4C987-2gYRepUm6vDFsdj9lHXqKD6prVZBSlIqCHDo3QsRK4wXzb557xDTI5vsE9uICsYeGaRt8Jqs5z\_g35ajTWnj3RxrxePDkKLbPnt6-1e2U4yrIpZVyZUug1h-Acs0gEdZN5yA-FjLhhD7f2-NWkDwW4mJkcwNnSY7fk\_PMSyYhX2mbVyXA2vj1BOZyBw

---

<div class="post-metadata">

**Author:** ![yashovardhan](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/yashovardhan/32/1526_2.png) [@yashovardhan](https://builder.metamask.io/u/yashovardhan)\
**Post date:** [October 17, 2023, 1:34pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/2 "2023-10-17T13:34:15Z")

</div>

Please share your implementation code.

---

<div class="post-metadata">

**Author:** ![sharan](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sharan](https://builder.metamask.io/u/sharan)\
**Post date:** [October 17, 2023, 1:46pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/3 "2023-10-17T13:46:35Z")

</div>

```auto
const chainConfig = {
        chainId: chainIdInHex,
        chainNamespace: Base.CHAIN_NAMESPACES.OTHER,
        rpcTarget: rpc
    }
const web3auth = new SingleFactorAuth.Web3Auth({
    clientId: WEB3AUTH_CLIENT_ID,
    web3AuthNetwork: "legacy_testnet",
    chainConfig 
    // usePnPKey: "false",
});
const privateKeyProvider = new BaseProvider.CommonPrivateKeyProvider({config: {chainConfig}});
web3auth.init(privateKeyProvider);
const parsedJWT = await JSON.parse(atob(jwt.split('.')[1]));
console.log("JWT parsed:", parsedJWT);
await web3auth.connect({
    verifier: WEB3AUTH_VERIFIER_NAME, // e.g. `web3auth-sfa-verifier` replace with your verifier name, and it has to be on the same network passed in init().
    verifierId: parsedJWT.sub, // e.g. `Yux1873xnibdui` or `name@email.com` replace with your verifier id(sub or email)'s value.
    idToken: jwt, // replace with your newly created unused JWT Token.
});
const privateKey = await provider.request({method: "private_key"});

```

---

<div class="post-metadata">

**Author:** ![yashovardhan](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/yashovardhan/32/1526_2.png) [@yashovardhan](https://builder.metamask.io/u/yashovardhan)\
**Post date:** [October 17, 2023, 2:16pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/4 "2023-10-17T14:16:17Z")

</div>

Replace ‘legacy\_testnet’ with ‘testnet’

---

<div class="post-metadata">

**Author:** ![sharan](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sharan](https://builder.metamask.io/u/sharan)\
**Post date:** [October 17, 2023, 3:41pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/5 "2023-10-17T15:41:08Z")

</div>

I am getting the following error after the above suggested change:

```auto
torusUtils.esm.js:510 Uncaught (in promise) Error: Error occurred while verifying params could not validate field iss, token https://stg-acme.us.auth0.com/, expected https://stg-acme.us.auth0.com/
    at torusUtils.esm.js:510:20
    at <anonymous>

```

The both look the same.

Verifier ID: `acmecore-iss3`

---

<div class="post-metadata">

**Author:** ![yashovardhan](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/yashovardhan/32/1526_2.png) [@yashovardhan](https://builder.metamask.io/u/yashovardhan)\
**Post date:** [October 17, 2023, 4:49pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/6 "2023-10-17T16:49:37Z")

</div>

There is a space at the end/ beginning of your iss value. Please update your verifier on dashboard to remove that.

---

<div class="post-metadata">

**Author:** ![sharan](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sharan](https://builder.metamask.io/u/sharan)\
**Post date:** [October 17, 2023, 5:12pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/7 "2023-10-17T17:12:34Z")

</div>

It now says this:

```auto
torusUtils.esm.js:510 Uncaught (in promise) Error: Verifier not supported
    at torusUtils.esm.js:510:20
    at <anonymous>

```

---

<div class="post-metadata">

**Author:** ![sharan](https://avatars.discourse-cdn.com/v4/letter/s/258eb7/32.png) [@sharan](https://builder.metamask.io/u/sharan)\
**Post date:** [October 17, 2023, 6:08pm UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/8 "2023-10-17T18:08:00Z")

</div>

This is what worked for me:

```auto
chainConfig = {
                    chainId: "0x" + parseInt(chainId).toString(16),
                    chainNamespace: Base.CHAIN_NAMESPACES.OTHER,
                    rpcTarget: rpc
                }
            web3auth = new SingleFactorAuth.Web3Auth({
                clientId: "<%= WEB3AUTH_CLIENT_ID %>",
                web3AuthNetwork: "testnet",
                chainConfig 
            });
            privateKeyProvider = new BaseProvider.CommonPrivateKeyProvider({config: {chainConfig}});
            web3auth.init(privateKeyProvider);
            web3auth.ready=true
            console.log("wallet instantiated:", web3auth.ready);
            const parsedJWT = await JSON.parse(atob(jwt.split('.')[1]));
            console.log("JWT parsed:", parsedJWT);
            provider = await web3auth.connect({
                verifier: "<%= WEB3AUTH_VERIFIER_NAME %>", // e.g. `web3auth-sfa-verifier` replace with your verifier name, and it has to be on the same network passed in init().
                verifierId: parsedJWT.sub, // e.g. `Yux1873xnibdui` or `name@email.com` replace with your verifier id(sub or email)'s value.
                idToken: jwt, // replace with your newly created unused JWT Token.
            });
            const privateKey = await provider.request({method: "private_key"});

```

Note that I had to manually indicate that the wallet is instantiated using `web3auth.ready=true` otherwise it errored saying that the wallet is not instantiated yet.

---

<div class="post-metadata">

**Author:** ![yashovardhan](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/yashovardhan/32/1526_2.png) [@yashovardhan](https://builder.metamask.io/u/yashovardhan)\
**Post date:** [October 18, 2023, 7:28am UTC](https://builder.metamask.io/t/archive-error-connecting-using-sfa-sdk/1730/9 "2023-10-18T07:28:02Z")

</div>

Hey Sharan

I’d request to kindly read through our examples of SFA, which have clearly mentioned the whole process of integration.

```
  <a href="https://github.com/Web3Auth/web3auth-core-kit-examples/tree/main/single-factor-auth-web" target="_blank" rel="noopener">github.com</a>

```

### 

[//github.com/Web3Auth/web3auth-core-kit-examples/tree/main/single-factor-auth-web](https://github.com/Web3Auth/web3auth-core-kit-examples/tree/main/single-factor-auth-web)

As I see from your code, please do not manually set web3auth.ready to `true` since that variable is meant to indicate you the status of the SDK initialisation. If you manually set that, it will definitely error out.  
Just add an `await` before `web3auth.init(privateKeyProvider)` function. It is meant to be called in your constructor.
