Password Change
The typical password-change flow in a mobile application consists of the following steps:
-
Prompt the user for their current password.
- Validate the current password with the server:
powerAuthSDK.beginPasswordChange(context, "oldPassword", object: IBeginPasswordChangeListener { override fun onBeginPasswordChangeSucceed(changeData: PowerAuthPasswordChangeData) { // Password is valid, keep the PowerAuthPasswordChangeData object aside and use in the step 4. } override fun onBeginPasswordChangeFailed(t: Throwable) { // Error occurred. } })Keep the received
changeDataobject aside for later. If the user cancels the process after this step, you should either release the storedchangeDataobject or callsecureClear()to ensure that all sensitive information is destroyed:changeData.secureClear() -
If the current password is valid, allow the user to enter and confirm a new password.
- Submit the new password to the server:
powerAuthSDK.finishPasswordChange(context, "newPassword", changeData: PowerAuthPasswordChangeData, object: IFinishPasswordChangeListener { override fun onFinishPasswordChangeSucceed() { // Password was changed. } override fun onFinishPasswordChangeFailed(t: Throwable) { // Error occurred. } })
Read Next
Last updated on Oct 23, 2026 (12:47)
Edit on Github
Send Feedback