How to attempt user to login?

When asking for help in this category, please make sure to provide the following details:

  • SDK Version:
    • "@web3auth/no-modal": "7.0.4"
    • "@web3auth/openlogin-adapter": "7.0.4"
  • Platform: ?
  • Browser Console Screenshots: ?

Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.

const login: IWeb3AuthContext['login'] = useCallback(
    async (loginProvider, jwtToken, redirectUrl = '/') => {
      setIsLoading(true)
      try {
        if (!web3auth) {
          throw new Error('web3auth not initialized yet')
        }
        await web3auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, {
          relogin: true,
          loginProvider,
          extraLoginOptions: {
            id_token: jwtToken,
            domain: process.env.NEXT_PUBLIC_APP_URL
          },
          redirectUrl
        })
      } catch (err) {
        console.error('web3auth.connectTo error', err)
        throw err
      } finally {
        setIsLoading(false)
      }
    },
    [web3auth]
  )

Description

In the situation: We are fixing bug which if user closes window while logging into Web3Auth, our login process continues and Auth0’s login will be true.
This make user’s state, Auth0 is registered, but Web3Auth is not registered and thus it means we cannot use user’s wallet address in our backend.

So, how do we attempt user to login?
We are currently using Web3AuthNoModal.connectTo() to login, but it is provided by Context.Provider, that means we cannot get jwtToken manually…

@rikusen0335 Welcome Aboard!

Your request has been forwarded to our Dev team and we will get back with further updates.

Wait, so does it mean we cannot implement this feature by our side?
Thank your for your reply anyway

@rikusen0335 Please be patient while our team reviews your post and give you an update.

Well, for now I’ve got a function that can obtain jwt token in my logic side.

Will check like:

async () => {
  const token = await getToken()
  if (!token) return // or throw Error
 
  await web3auth.connectTo(adapter, {
    ...,
    extraLoginOptions: { id_token: token, ... },
  })
}

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