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 phoneVerified
remains to be set to unset
value, 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:
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!GitHub
convex-auth-example/convex/otp/TwilioVerify.ts at main · get-convex...
Convex Auth example repo. Contribute to get-convex/convex-auth-example development by creating an account on GitHub.
5 Replies
Can someone help me with that?
I am fairly new to Convex so any help is much appreciated.
Using Phone provider the 'phoneVerified' successfully gets updated. I haven't figured it out how to do it using a custom provider, e.g. ConvexCredentials.
Looking at the convex-auth code, I think you want
phoneVerified: true
instead of phoneVerificationTime: Date.now()
, but the types on createAccount
aren't correct (I'll look into fixing)Thanks for your reply. I thought the same about
phoneVerified: true
but since you mention about the types on createAccount
I'm guessing that you already noticed that this is currently not possible to do.
Also a point to mention is that after using Convex's integrated Phone provider I have noticed that phoneVerified
is set to the same value as Account Id, which is a string with phone number, so phoneVerified
is not of boolean value, but string.Making this change to the example + clearing my existing user + authAccounts entries for the phone number I was testing with seemed to result in
phoneVerificationTime
getting set + phoneVerified
getting set to the number:
There's definitely something buggy here, but hopefully this unblocks you until it's fixed.This solution seems to work as expected. Thank you.
However, and maybe it's just my wrong thinking, I would have expected that the
phoneVerified: true
should be set in the account
segment and not in profile
segment. Two reasons, number one the information about verified phone is stored in the account
document, second a profile
(user) can have multiple accounts/providers and more of those can use phone verification.
Or is all this part of the bug that needs to get resolved? 🙂