Web3Auth Issue with Wagmi, Address is missing

Description:
Steps to reproduce:

  1. Go to Web3Auth Quick Start (Next.js).

  2. Click Preview.

  3. Log in with a social account.

  4. Click Logout.

  5. Log in again with MetaMask.

Expected Result:

  • The address should also be displayed after logging in with MetaMask.

Actual Result:

Environment:

  • Framework: Next.js (Web3Auth Quick Start sample)
  • Login providers tested: Social account (works), MetaMask (fails)

Thanks for the detailed report and screenshots! Here’s a summary for the support team and some suggestions to help troubleshoot:


Issue Summary

  • SDK/Integration: Web3Auth Plug n Play (PnP), using the Web3Auth Next.js Quick Start
  • Framework/Platform: Next.js (Web)
  • Login Providers Tested:
    • Social login (works, address shown)
    • MetaMask (fails, address missing after login)
  • Issue:
    • After logging in with MetaMask, the user’s address is not displayed (see provided screenshots).
    • Logging in with a social account works as expected.

Details Provided

  • Screenshots: Yes (social login success, MetaMask login missing address)
  • Steps to Reproduce: Clear and included
  • Code/Links: Using official Web3Auth Quick Start sample

Additional Details Needed

To help the support team debug further, could you please provide:

  1. Web3Auth and Wagmi version numbers used in your project (if different from the sample).
  2. Any custom code changes made to the Quick Start sample, especially related to Wagmi or provider setup.
  3. Browser console logs or errors after logging in with MetaMask (if any appear).

Possible Cause & Suggestions

  • The Web3Auth Next.js Quick Start is primarily designed for social logins via Web3Auth’s own provider.
  • When logging in with MetaMask, the dApp might be switching to the MetaMask provider, which could bypass Web3Auth’s account/address logic.
  • Solution:
    • Ensure you are retrieving the address from the correct provider after MetaMask login.
    • If using Wagmi, check how your provider is set after MetaMask login. You may need to call getAccount() from Wagmi or provider.listAccounts() from ethers.js.
    • Review the Web3Auth + Wagmi integration guide for best practices.

References


Next Steps:
Please reply with your version numbers, any relevant code snippets, and/or console logs after MetaMask login. This will help us pinpoint the issue and suggest a precise fix!

Thanks for your patience and clear reporting!

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.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours