Web3Auth / web3auth-web

Simple infrastructure that enables Web3 wallets and applications to provide seamless user logins for both mainstream and Web3.0 users.
https://web3auth.io/docs
Other
426 stars 229 forks source link

"Unable to detect device share." Error when using web3auth/core, but not when using web3auth/modal #1375

Open moldy530 opened 1 year ago

moldy530 commented 1 year ago

Getting "Unable to detect device share." error when using connectTo("openlogin", loginParams) but not when using connect()

If I use web3auth/modal and I'm able to successfully connect with openlogin as long as I use the connect() method. However, if I want to use web3auth/core (ie. connectTo) I get the Unable to detect device share screen

To Reproduce

Steps to reproduce the behavior:

  1. Setup web3auth modal as described in: https://web3auth.io/docs/sdk/web/modal/initialize
  2. call web3auth.connect() --> this should show the modal and the flow should succeed
  3. swap the call from web3auth.connect to something like web3auth.connectTo("openlogin", loginParams: {loginProvider: "google"}) (use the same method as you did in 2 and the same account)
  4. going through the flow will work on first attempt (ie. account has never been registered to web3auth before). Logout of web3auth or use a different chrome profile and connect again. See the error screen below 4a. I noticed that the public address is also different between the two methods when connectTo succeeds the first time.

Expected behavior

I would expect:

  1. connectTo to work successfully across devices, profiles, and sessions the same as connect
  2. the resulting public keys to be the same regardless of whether I'm using connect or connectTo

Screenshots

image

Device Info (please complete the following information):

Additional context

My setup:

const web3auth = new Web3Auth({
  clientId: "<MY_CLIENT_ID>",
  chainConfig: {
    chainNamespace: "eip155",
  },
  enableLogging: true,
  web3AuthNetwork: "testnet",
  storageKey: "local",
});
const openloginAdapter = new OpenloginAdapter({
  adapterSettings: {
    uxMode: "popup",
    network: "testnet",
    storageKey: "local",
  },
  loginSettings: {
    mfaLevel: "mandatory",
  },
});
web3auth.configureAdapter(openloginAdapter);

useEffect(() => {
    if (web3auth.status === "not_ready") {
      web3auth.initModal({
        modalConfig: {
          "torus-evm": {
            label: "Torus Wallet",
            showOnModal: false,
          },
          metamask: {
            label: "Metamask",
            showOnModal: false,
          },
          "wallet-connect-v1": {
            label: "Wallet Connect",
            showOnModal: false,
          },
        },
      });
}, [])

const login = (
    loginProvider: LoginProvider
) => {
    await web3auth.logout().catch(() => null); // this is here to just to repro the issue

    // comment out one of these to test independently
    await web3auth.connect(); // this works consistently
    await web3auth.connectTo("openlogin", loginParams: { loginProvider }); // this does not work after first time logging in
}
moldy530 commented 1 year ago

possibly related? https://github.com/Web3Auth/web3auth-web/issues/1238

chusla commented 1 year ago

hello i'm seeing this one as well, anyone from web3auth able to provide info on fixes?

IMG_1660

Jo-Chris commented 1 year ago

+1