Skip to content

Unable to login with the existing email and different Web3AuthClientId. Error: "factorKey not present" #131

@lwin-kyaw

Description

@lwin-kyaw

SDK Versions

  • @web3auth/mpc-core-kit@2.3.0
  • @tkey-mpc/core@9.1.1
  • @tkey-mpc/storage-layer-torus@9.1.0

This issue is related to the concurrent login issue, #115.

Steps to reproduce

  • concurrently login with new user email (as of latest tkey-core sdk (v9.1.1), the logins will be success without any errors)
  • log into another coreKit instance with the email used above
  • it will throw an error which indicates factor key is not present (note: with manualSync:false, it will throw a different error, COREKIT_STATUS.REQUIRED_SHARE which is caused by factor not present)

A little bit more details about the issues

By following the trace, I found that the error is located in coreKit setupTkey method:

  • at https://github.com/Web3Auth/mpc-core-kit/blob/master/src/mpcCoreKit.ts#L901, we check the existing metadata with OAuthKey we got from the login
  • since this is the existing email, there's an existing metadata and we assume this account as existing user
  • then we continue to the usual steps for the existing user and here, https://github.com/Web3Auth/mpc-core-kit/blob/master/src/mpcCoreKit.ts#L939, we create a hashedFactorKey and validate it by checking the metadata again
  • however, there's no metadata related to the hashedFactorKey we created above, hence skipping all the later steps and methods including the one which set the factor key
  • the above will result in unable to login when using manualSync:false and factor not present when using manualSync:true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions