Unable to Login via Phantom

"@web3auth/base": "^8.12.4",
"@web3auth/modal": "^8.12.4",
"@web3auth/phantom-adapter": "^8.12.4",
"@web3auth/solana-provider": "^8.12.4",
useEffect(() => {
    init();
  }, []);

const init = async () => {
    const web3auth = new Web3Auth(web3AuthOptions as Web3AuthOptions);
    const openloginAdapter = new OpenloginAdapter({
        loginSettings: {
          mfaLevel: "none",
          curve: "ed25519",
        },
        adapterSettings: {
          uxMode: "redirect",
          whiteLabel: {
            ...
          },
        },
      });
      web3auth.configureAdapter(openloginAdapter);
      const phantomAdapter = new PhantomAdapter();
      web3auth.configureAdapter(phantomAdapter);

      setWeb3auth(web3auth);

      await web3auth.initModal({
        modalConfig: {
          [WALLET_ADAPTERS.PHANTOM]: {
            label: "phantom",
          },
          [WALLET_ADAPTERS.OPENLOGIN]: {
            label: "openlogin",
            loginMethods: { ....

Users are able to login via Google/Twitter, etc., but they are unable to login via Phantom.

The Phantom wallet can popup and after I click the connect button in the Phantom wallet, I see a successfully connected message in the Web3Auth Modal.

However, my website isn’t re-rendered. i.e. My if (web3auth.connected) { code won’t be triggered.

I tried to pass web3AuthOptions to PhantomAdapter constructor, but that won’t work as well.

Screenshot 2024-11-21 at 11.13.56 AM

Hi Zhe Wang! Thank you for reaching out with your issue.

I see you’re facing a problem with logging in via the Phantom wallet using the Web3Auth SDK. Here’s a summary of the details you provided for our support team:

Issue Report:

  • SDK Details: Help - Plug n Play
  • SDK Version Numbers:
    • @web3auth/base: ^8.12.4
    • @web3auth/modal: ^8.12.4
    • @web3auth/phantom-adapter: ^8.12.4
    • @web3auth/solana-provider: ^8.12.4
  • Platform: Not specified (please provide this if applicable).

Problem Description:

  • Users can log in via Google/Twitter but encounter issues with Phantom wallet.
  • After clicking the connect button in the Phantom wallet, a success message appears in the Web3Auth Modal, but the website isn’t re-rendering, and the if (web3auth.connected) code isn’t triggered.

Code Snippet:

You’ve shared a snippet that shows your initialization process.

Screenshot:

Screenshot 2024-11-21 at 11.13.56 AM

Proposed Solution:

Since it seems like the connection is successful but not triggering a re-render, I recommend checking two things:

  1. Ensure that the state management around web3auth.connected is set up correctly to trigger a re-render.
  2. Also, consider increasing the visibility of any error handling in the connection process that might help shed light on why it’s not triggering.

If you have any browser console errors or additional images/screenshots that might provide more context on the error, please feel free to share.

Let me know if there’s anything else you need or if you have more details to provide!

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.

Ok, so I just updated my code to the latest version of SDKs.

      const web3auth = new Web3Auth(web3AuthOptions as Web3AuthOptions);

      const authAdapter = new AuthAdapter({ privateKeyProvider: privateKeyProvider });
      web3auth.configureAdapter(authAdapter)
      setWeb3auth(web3auth);

      await web3auth.initModal()

It works for social logins, but how can I add Phantom to the login modal?

Ok I asked in: Phantom Adapter won't work with latest Modal SDK

Please help there instead. Thanks!

I have replied on other thread, is it okay if we close this thread and use a single thread?

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