Error connecting using SFA SDK

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

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
    • Sample idToken(JWT): eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ikg5QWdjTnRGWGJWejBsZGQ2RXRQTSJ9.eyJnaXZlbl9uYW1lIjoiU2hhcmFuIiwiZmFtaWx5X25hbWUiOiJZYWxidXJnaSIsIm5pY2tuYW1lIjoic2hhcmFuIiwibmFtZSI6IlNoYXJhbiBZYWxidXJnaSIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NMWUt1NERJMFAta0tjZUc5Mld1dWZCV1M2VzAyenpVcVJ2RkhmcjJqbkg9czk2LWMiLCJsb2NhbGUiOiJlbiIsInVwZGF0ZWRfYXQiOiIyMDIzLTEwLTEzVDE4OjI3OjI3LjU1MVoiLCJlbWFpbCI6InNoYXJhbkBhY21lZGFvLmNvbSIsImVtYWlsX3ZlcmlmaWVkIjp0cnVlLCJpc3MiOiJodHRwczovL3N0Zy1hY21lLnVzLmF1dGgwLmNvbS8iLCJhdWQiOiJ0Q29Oc2xJVlVwNTJrU3pXZXJkanp1S0hndkxsQnlmWSIsImlhdCI6MTY5NzQ3MjMxNCwiZXhwIjoxNjk3NTA4MzE0LCJzdWIiOiJnb29nbGUtb2F1dGgyfDEwMTgzNjQ5NjM4ODk1OTY5MzMyOCIsInNpZCI6ImpvV3BUc3Fsc3J3WTNvUGZINkZKclcwcGx1R2Zud3VHIiwibm9uY2UiOiI3MTIwN2NiMTEwYjkwZDhiMmMzNGYwZTg3YjRmOWE0YSJ9.O1tagfFaTV84nCU-v2fIlQgT0Yg-EL3oa0cfFXlcwIrsYrzNcPcylZBMWRRxFGIhpxn3uFIgD5u17vIr4GbvnOVoZ6SAWmocTEvdVbpQtsevyCxPHikQR4itghU-VKxNg-y9PEpkho0Xd8tO05Iot4C987-2gYRepUm6vDFsdj9lHXqKD6prVZBSlIqCHDo3QsRK4wXzb557xDTI5vsE9uICsYeGaRt8Jqs5z_g35ajTWnj3RxrxePDkKLbPnt6-1e2U4yrIpZVyZUug1h-Acs0gEdZN5yA-FjLhhD7f2-NWkDwW4mJkcwNnSY7fk_PMSyYhX2mbVyXA2vj1BOZyBw

Please share your implementation code.

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"});

Replace ‘legacy_testnet’ with ‘testnet’

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

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

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

It now says this:

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

This is what worked for me:

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.

Hey Sharan

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

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.