Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lwin-kyaw opened this issue May 2, 2024 · 1 comment

Comments

@lwin-kyaw
Copy link
Contributor

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
@lwin-kyaw
Copy link
Contributor Author

I've made a draft PR, tkey/tkey-mpc#10, which will fix this issue.

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

No branches or pull requests

1 participant