Use this file to discover all available pages before exploring further.
Let an authenticated user change their password from the account area. The SDK acquires the prld:pwd:write session scope via a short OTP challenge, then calls the change password endpoint — the scope is consumed atomically on save.See the Logged-in Change Password guide for the backend configuration (direct step-up on prld:pwd:write). This page focuses on the frontend integration.
import { PrldErrors } from "@prelude.so/js-sdk";async function changePassword(newPassword) { const { status } = await client.requestStepUp({ scope: "prld:pwd:write", onChallenge: async (info) => { if (info.currentStep === "verify_email" || info.currentStep === "verify_sms") { // Send the OTP — the user will enter the code in your UI and // your form handler will call client.checkOTP(...) with it. await client.startOTP({ challengeId: info.challengeId }); } }, }); if (status === "block") { throw new Error("Change password denied"); } // The SDK refreshes the session automatically once the last step is // completed, so the access token now carries prld:pwd:write. await client.changePassword(newPassword);}
For the full step-up SDK surface (startOTP, checkOTP, retryOTP, challenge callback shape), see Step-Up.
Try it
This example builds on the project from Introduction. Make sure you have a working password login first (Password) and that the user you log in with has an email_address or phone_number identifier.1. Configure direct step-up for prld:pwd:write
Run npm run dev, log in, then click Change password. You’ll receive an OTP on the identifier type configured above. After verification, enter a new password — the prld:pwd:write scope is consumed atomically on save and removed from the session.