hi <@498057949541826571> i am trying to update us...
# general
a
hi @rp_st i am trying to update user's phoneNumber who has logged in with google/apple login , but getting this error message Error: Cannot update a user who signed up using third party login using updatePasswordlessUser. can you please explain whi is this happening
r
hey @anurag06557 this happens cause the user is a thirdparty user and not a passwordless user.
if you want to add a phone number to the user, then you have to create a separate passwordless user, and then manually link that recipe user id to the existing user. This requires that you use our paid account linking feature.
a
I am using account linking, I first logged in with eamil and otp i.e. passwordless, then i logged in with google using same email , now i try to update the users phoneNumber , but was unable to do so. Is this as my logged in session was of google signin? because when my logged in session was of passwordless, then i was able to update the phonenumber
r
are the passwordless and google users already linked?
a
yes
r
right. So you need to get the recipeUserId of the passwordless user. For that, do this: - fetch the user object using getUser(session.getUserId()) - loop through the loginMethods of the resulting user object to find the recipeUserId where the recipeId is
passwordless
- call the updatePasswordlessUser on that recipeUserId
a
ok
one more case if i need to update the email of an account that have multiple recipe users ID , two of thirdParty and one of Passwordless, so how can i update the email in this case?
r
You can only update the Passwordless one. Cause third party email comes from the provider.
And when you update the passwordless one, make sure to also mark that email as verified
a
then there will be an issue that user will have the new email but the google id linked to his account will be of old user
r
It won’t be an issue
User will still be able to login as usual
a
but in his profile there will be two extra login methods which wil not be his own
is there any way so that we can removw those recipeUserId from the account
r
yea, there is a function call unlinkAccounts
a
ok