Skip to content

fix: wait for the Web3Auth AUTH connector before social login - #49

Merged
jinoosss merged 2 commits into
mainfrom
fix-social-login-connector-wait-0-1-3
Nov 13, 2026
Merged

jinoosss merged 2 commits into
mainfrom
fix-social-login-connector-wait-0-1-3

Conversation

@jinoosss

Copy link
Copy Markdown
Member

Summary

Fixes social login (Google / Twitter / Email passwordless) hanging with Wallet connector is not ready yet on @adena-wallet/sdk@0.1.2 (@web3auth/no-modal@11.4.3), and bumps the packages to v0.1.3.

Root cause

In Web3Auth v11, Web3AuthNoModal.init() resolves before connectors finish initializing:

  • loadConnectors() → setConnectors() emits CONNECTORS_UPDATED synchronously, and the async listener that runs setupConnector() → connector.init() is not awaited.
  • AuthConnector.init() only sets status = READY and emits READY after the auth iframe has loaded.

GnoSocialWalletProvider.connect() called connectTo() right after init(). connectTo() calls connector.connect() inside a new Promise(...) executor without awaiting or catching it, so the checkConnectionRequirements() error became an unhandled rejection, and connectTo() (which only settles on CONNECTED / ERRORED) never settled. As a result, connectWallet() neither resolved nor rejected.

There is also a restored-session case. When a cached session exists, AuthConnector.init() emits READY and then immediately starts rehydrating it (status = CONNECTING). Waiting only for READY would still leave web3auth.connected === false, and calling connectTo() at that point throws Already connecting the same way.

Changes

  • GnoSocialWalletProvider.initializeWeb3Auth() now calls waitForAuthConnectorReady() after await web3auth.init():
    • Throws a clear error if the AUTH connector is missing. In v11 it is only registered when the dashboard project config has embeddedWalletAuth.
    • If the connector is not_ready, waits for READY and rejects on ERRORED.
    • If the connector is then connecting (rehydrating a cached session), waits for Web3Auth CONNECTED or connector REHYDRATION_ERROR. After a rehydration error the connector is ready again, so a fresh login follows.
    • Each wait is bounded by a 30s timeout. Connector init failures are only logged by Web3Auth and never re-thrown, so the timeout is what surfaces them. Listeners and the timer are removed on every path.
    • Uses CONNECTOR_STATUS / CONNECTOR_EVENTS from @web3auth/no-modal instead of string literals.
  • Added CONNECTOR_STATUS / CONNECTOR_EVENTS to the Jest stub of @web3auth/no-modal.
  • Bumped package.json and packages/sdk/package.json to 0.1.3.

Tests

Added gno-social-wallet-connect.test.ts, which uses a mocked Web3AuthNoModal:

  • init() resolves while the connector is not_ready → connectTo is called only after ready
  • Connector already ready → no wait
  • errored → connect() returns false without calling connectTo
  • No ready within 30s → connect() returns false with a timeout error
  • Missing AUTH connector → connect() returns false with a clear error
  • Cached session rehydration → waits for connected and reuses the session without connectTo
  • Rehydration error → falls back to a fresh connectTo

Without the fix, 6 of the 7 new tests fail. The "already ready" test passes either way. yarn jest (162 tests), yarn lint, and yarn build pass.

Release

Publish as @adena-wallet/sdk@0.1.3. The consumer (gnoswap-interface PR #1091) will then bump from ^0.1.2 to ^0.1.3.

Web3Auth v11 resolves init() before the AUTH connector finishes initializing, so connectTo() hit a not-ready connector and never settled. Wait for the connector to become ready (and for a cached session to finish rehydrating) with a timeout.
@jinoosss jinoosss changed the title fix: wait for the Web3Auth AUTH connector before social login (v0.1.3) fix: wait for the Web3Auth AUTH connector before social login Nov 13, 2026
@jinoosss
jinoosss merged commit 1fd9cba into main Nov 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants