fbeleF
Convex Community17mo ago
6 replies
fbele

How to update the 'phoneVerified' field in authAccounts table after a successful phone verification?

I implemented the Twilio phone provider example as showed here: https://github.com/get-convex/convex-auth-example/blob/main/convex/otp/TwilioVerify.ts

The phone number and later the code (OTP) verification is working without an issue and a user (if not existing) and also an account are successfully created.

However I've noticed that in the authAccounts table, the phoneVerifiedremains to be set to unsetvalue, which of course it shouldn't be, because I made sure that the phone is verified.

I have tried using the following code to update, but it only updates the
user
table accordingly:

    const { user } = await createAccount(ctx, {
      provider: "phone",
      account: {
        id: phone,
      },
      profile: {
        phone,
        isAnonymous: false,
        phoneVerificationTime: Date.now(),
      },
      shouldLinkViaPhone: true,
    });


As in the example code is also described, this implementation uses ConvexCredentials Provider to create an account.

How can I make sure, that the phoneVerified field in authAccounts table gets update properly?

Thank you for any support!
image.png
GitHub
Convex Auth example repo. Contribute to get-convex/convex-auth-example development by creating an account on GitHub.
convex-auth-example/convex/otp/TwilioVerify.ts at main · get-convex...
Was this page helpful?