To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their phone number, you can use the updatePhone
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing phone number to a new one. If a user does not already have a phone account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To configure callbacks for Privy’s updateEmail
and updatePhone
methods, use the useUpdateAccount
hook:
The useUpdateAccount
hook accepts an options object with the following fields:
Optional callback to run after a user successfully updates an account.
Optional callback to run if there is an error during the update account flow, or if the user exits the flow prematurely.
If set, the onSuccess
callback will execute after a user has successfully updated either their phone or email on their Privy account.
Within this callback, you can access:
The user object with the user’s DID, linked accounts, and more.
A string indicating the type of update flow just executed for the authenticated user.
Possible values are 'email'
or 'sms'
.
An object representing the account that was just updated on the authenticated user.
If set, the onError
callback will execute after a user initiates an update account attempt and there is an error, or if the user exits the update account flow prematurely.
Within this callback, you can access:
The error code with more information about the error.
A string indicating the type of update account flow just attempted for the authenticated user.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their phone number, you can use the updatePhone
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing phone number to a new one. If a user does not already have a phone account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To configure callbacks for Privy’s updateEmail
and updatePhone
methods, use the useUpdateAccount
hook:
The useUpdateAccount
hook accepts an options object with the following fields:
Optional callback to run after a user successfully updates an account.
Optional callback to run if there is an error during the update account flow, or if the user exits the flow prematurely.
If set, the onSuccess
callback will execute after a user has successfully updated either their phone or email on their Privy account.
Within this callback, you can access:
The user object with the user’s DID, linked accounts, and more.
A string indicating the type of update flow just executed for the authenticated user.
Possible values are 'email'
or 'sms'
.
An object representing the account that was just updated on the authenticated user.
If set, the onError
callback will execute after a user initiates an update account attempt and there is an error, or if the user exits the update account flow prematurely.
Within this callback, you can access:
The error code with more information about the error.
A string indicating the type of update account flow just attempted for the authenticated user.
To update a user’s email, use the useUpdateEmail
hook:
First, use the sendCode
method to send an OTP verification code to the user’s new email address:
The new email address to be validated.
This will send a one-time passcode to the new email address, which the user will need to enter to verify it and confirm the update.
The method returns a Promise
that resolves if the code was sent successfully, and rejects otherwise.
Prompt the user for the OTP they received and verify the OTP by passing it to the updateEmail
method:
The new email address to set.
The one time code received on the new email address.
A Promise
that resolves with the updated user object if the update was successful, and rejects otherwise.
To update a user’s email, use the useUpdateEmail
hook:
First, use the sendCode
method to send an OTP verification code to the user’s new email address:
The new email address to be validated.
This will send a one-time passcode to the new email address, which the user will need to enter to verify it and confirm the update.
The method returns a Promise
that resolves if the code was sent successfully, and rejects otherwise.
Prompt the user for the OTP they received and verify the OTP by passing it to the updateEmail
method:
The new email address to set.
The one time code received on the new email address.
A Promise
that resolves with the updated user object if the update was successful, and rejects otherwise.
To update a user’s phone number, use the useUpdatePhone
hook:
First, use the sendCode
method to send an OTP verification code to the user’s new phone number:
The new phone number to be validated.
This will send a one-time passcode to the new phone number, which the user will need to enter to verify it and confirm the update.
The method returns a Promise
that resolves if the code was sent successfully, and rejects otherwise.
Prompt the user for the OTP they received and verify the OTP by passing it to the updatePhone
method:
The new phone number to set.
The one time code received on the new phone number.
A Promise
that resolves with the updated user object if the update was successful, and rejects otherwise.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their phone number, you can use the updatePhone
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing phone number to a new one. If a user does not already have a phone account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To configure callbacks for Privy’s updateEmail
and updatePhone
methods, use the useUpdateAccount
hook:
The useUpdateAccount
hook accepts an options object with the following fields:
Optional callback to run after a user successfully updates an account.
Optional callback to run if there is an error during the update account flow, or if the user exits the flow prematurely.
If set, the onSuccess
callback will execute after a user has successfully updated either their phone or email on their Privy account.
Within this callback, you can access:
The user object with the user’s DID, linked accounts, and more.
A string indicating the type of update flow just executed for the authenticated user.
Possible values are 'email'
or 'sms'
.
An object representing the account that was just updated on the authenticated user.
If set, the onError
callback will execute after a user initiates an update account attempt and there is an error, or if the user exits the update account flow prematurely.
Within this callback, you can access:
The error code with more information about the error.
A string indicating the type of update account flow just attempted for the authenticated user.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their email, you can use the updateEmail
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing email to a new one. If a user does not already have an email account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To prompt users to change their phone number, you can use the updatePhone
method from the usePrivy
hook:
When invoked, the method will open the Privy modal and guide the user through updating their existing phone number to a new one. If a user does not already have a phone account and attempts to update it, Privy will throw an error indicating such.
In the event that a user encounters an error through the flow, their existing account will be maintained.
To configure callbacks for Privy’s updateEmail
and updatePhone
methods, use the useUpdateAccount
hook:
The useUpdateAccount
hook accepts an options object with the following fields:
Optional callback to run after a user successfully updates an account.
Optional callback to run if there is an error during the update account flow, or if the user exits the flow prematurely.
If set, the onSuccess
callback will execute after a user has successfully updated either their phone or email on their Privy account.
Within this callback, you can access:
The user object with the user’s DID, linked accounts, and more.
A string indicating the type of update flow just executed for the authenticated user.
Possible values are 'email'
or 'sms'
.
An object representing the account that was just updated on the authenticated user.
If set, the onError
callback will execute after a user initiates an update account attempt and there is an error, or if the user exits the update account flow prematurely.
Within this callback, you can access:
The error code with more information about the error.
A string indicating the type of update account flow just attempted for the authenticated user.
To update a user’s email, use the useUpdateEmail
hook:
First, use the sendCode
method to send an OTP verification code to the user’s new email address:
The new email address to be validated.
This will send a one-time passcode to the new email address, which the user will need to enter to verify it and confirm the update.
The method returns a Promise
that resolves if the code was sent successfully, and rejects otherwise.
Prompt the user for the OTP they received and verify the OTP by passing it to the updateEmail
method:
The new email address to set.
The one time code received on the new email address.
A Promise
that resolves with the updated user object if the update was successful, and rejects otherwise.
To update a user’s email, use the useUpdateEmail
hook:
First, use the sendCode
method to send an OTP verification code to the user’s new email address:
The new email address to be validated.
This will send a one-time passcode to the new email address, which the user will need to enter to verify it and confirm the update.
The method returns a Promise
that resolves if the code was sent successfully, and rejects otherwise.
Prompt the user for the OTP they received and verify the OTP by passing it to the updateEmail
method:
The new email address to set.
The one time code received on the new email address.
A Promise
that resolves with the updated user object if the update was successful, and rejects otherwise.
To update a user’s phone number, use the useUpdatePhone
hook:
First, use the sendCode
method to send an OTP verification code to the user’s new phone number:
The new phone number to be validated.
This will send a one-time passcode to the new phone number, which the user will need to enter to verify it and confirm the update.
The method returns a Promise
that resolves if the code was sent successfully, and rejects otherwise.
Prompt the user for the OTP they received and verify the OTP by passing it to the updatePhone
method:
The new phone number to set.
The one time code received on the new phone number.
A Promise
that resolves with the updated user object if the update was successful, and rejects otherwise.