reset

abstract suspend fun reset(request: IB2BPasswordExistingPasswordResetParameters): B2BPasswordExistingPasswordResetResponse

Resets a member's password by verifying their existing password, then setting a new one. Calls the POST /sdk/v1/b2b/passwords/existing_password/reset endpoint.

Kotlin:

StytchB2B.passwords.existingPassword.reset(
B2BPasswordExistingPasswordResetParameters(
organizationId = "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress = "user@example.com",
existingPassword = "oldpassword",
newPassword = "newpassword",
sessionDurationMinutes = 30,
)
)

iOS:

let params = B2BPasswordExistingPasswordResetParameters(
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
existingPassword: "oldpassword",
newPassword: "newpassword",
sessionDurationMinutes: 30
)
let response = try await StytchB2B.passwords.existingPassword.reset(params)

React Native:

StytchB2B.passwords.existingPassword.reset({
organizationId: "org-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
emailAddress: "user@example.com",
existingPassword: "oldpassword",
newPassword: "newpassword",
sessionDurationMinutes: 30,
})

Return

B2BPasswordExistingPasswordResetResponse containing the authenticated member session.

Parameters

request
  • IB2BPasswordExistingPasswordResetParameters

  • organizationId — The ID of the organization.

  • emailAddress — The member's email address.

  • existingPassword — The member's current password for verification.

  • newPassword — The new password to set.

  • sessionDurationMinutes — Duration of the session to create, in minutes.

  • locale? — Locale for any follow-up communications.

Throws

StytchError

if the existing password is incorrect or the new password is too weak.

if the coroutine is cancelled.