Aggregate Providers

I am using web3auth multiple aggregate provide with twitter , google , email passworless
the verifier id in google and email passwordless is email but twitter is not providing email
so the Verifier id in case of twitter is sub , it is working but the address I am getting is different for twitter , how can I get the same address of all three login methods

Hi Amit,

Thank you for your question! I understand you’re encountering an issue with using multiple aggregate providers with Web3Auth, specifically regarding the different verifier IDs and addresses for your login methods (Twitter, Google, and email passwordless).

Here’s a summary of your issue for the support team:

  • SDK Details: Plug n Play
  • Issue: Aggregate Providers with different verifier IDs
  • Login Methods: Twitter (sub), Google (email), and email passwordless (email)
  • Concern: Inconsistent addresses for the different login methods

To resolve this issue, you may want to check how the user identifiers (verifier IDs) are set up in your configuration. The goal is to maintain uniformity across different login methods.

If you have access to the Web3Auth initialization and login code snippets, sharing those would be helpful for further diagnosis. Additionally, if you have any console errors or screenshots to share, please include them.

Feel free to add any links or additional details that might help us understand your setup better!

Looking forward to your response!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Is there any suggestions ?

export const initWeb3Auth = async (chainConfig: ChainConfig) => {
  try {
    const ethereumPrivateKeyProvider = new EthereumPrivateKeyProvider({ config: { chainConfig } });


    const web3AuthOptions: IWeb3AuthCoreOptions = {
      clientId,
      web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
      privateKeyProvider: ethereumPrivateKeyProvider,
    }
    const web3auth = new Web3AuthNoModal(web3AuthOptions);

    const authAdapter = new AuthAdapter({
      adapterSettings: {
        loginConfig: {
          google: {
            verifier: "web3auth-test-verifier",
            verifierSubIdentifier: "wen3Auth-test-google",
            typeOfLogin: "google",
            clientId: auth0ClientId
          },
          twitter: {
            verifier: "web3auth-test-verifier",
            verifierSubIdentifier: "web3Auth-test-twitter",
            typeOfLogin: "twitter",
            clientId: auth0ClientId

          },
          email_passwordless: {
            verifier: "web3auth-test-verifier",
            verifierSubIdentifier: "web3Auth-test-emailpasswordless",
            typeOfLogin: "email_passwordless",
            clientId: auth0ClientId
          }
        },
      },
      privateKeyProvider: ethereumPrivateKeyProvider,
    });

    web3auth.configureAdapter(authAdapter);

    await web3auth.init();
    return web3auth;
  } catch (error) {
    console.error('Error initializing Web3Auth:', error);
    return null;
  }
};

export const loginWithProvider = async (providerName: string, chain: string, adapterType?: string, email?: string) => {
  try {
    //@ts-ignore
    const config = chainConfig[chain];
    const web3auth = await initWeb3Auth(config);
    console.log(web3auth, "MOSH");

    console.log('providerName:', providerName)
    console.log('email:', email)
    if (!web3auth) {
      throw new Error('Web3Auth initialization failed. Please check the configuration.');
    }
    let web3authProvider
    if (adapterType === 'social') {
      web3authProvider = await web3auth.connectTo(WALLET_ADAPTERS.AUTH, {
        loginProvider: providerName,
        extraLoginOptions: {
          domain: "https://devdeca.us.auth0.com", // Pass on the Auth0 `Domain` here
          verifierIdField: "sub", // Pass on the field name of the `sub` field in the JWT
          connection: "google", // Use this to skip Auth0 Modal for Twitter / X login
        },
      });
    } else if (adapterType === 'email_passwordless') {
      web3authProvider = await web3auth.connectTo(WALLET_ADAPTERS.AUTH, {
        loginProvider: providerName,
        extraLoginOptions: {
          login_hint: email?.trim(),
        },
      });
    } else if (adapterType === 'twitter') {
      web3authProvider = await web3auth.connectTo(WALLET_ADAPTERS.AUTH, {
        loginProvider: providerName,
        extraLoginOptions: {
          domain: "https://devdeca.us.auth0.com", // Pass on the Auth0 `Domain` here
          verifierIdField: "sub", // Pass on the field name of the `sub` field in the JWT
          connection: "twitter", // Use this to skip Auth0 Modal for Twitter / X login
        },
      });
    }



    console.log('Provider logged in:', web3authProvider, await web3auth.getUserInfo());

    return { web3auth, web3authProvider };
  } catch (error) {
    console.error('Login failed with provider:', providerName, error);
    return null;
  }
};

Hey, this is expected behaviour. When you create an account using twitter, you ideally have an option to create the account using your phone number. Hence, you won’t be able to access the user’s email address. If user has used email address to create the account, you can access it by doing this configuration. Please go through this link for more information on getting the email address for the Twitter.

Since, you are not able to get the email address, the aggregate login won’t work as it requires one verification field to be the same.

Thanks for the suggestion. As mentioned in the attached link, after authentication using the received Auth0 keys, we can retrieve the user profile using the Auth0 Management API.

Will this provide the same address for all three login methods? My main concern is how I can ensure the same address is generated for different login methods.

As I said it would depend on the cases:

  1. User has created the Twitter account using phone number, in this case the user won’t have same address across all the three login methods since you don’t have email to aggregate the account.
  2. User has created the Twitter account using the email address and you are able to get the email address, in this case user can have same address across all the three login methods since you will have same “verifier_id” which is user’s email to aggregate the account.

Learn more about aggregate verifiers: Creating Aggregate Verifier on Web3Auth Dashboard | Documentation | Web3Auth

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.