Request a scope
Initiate a step-up flow for a given scope. The SDK handles challenge token caching, DPoP proofs, and automatic session refresh on completion.
The
onChallenge callback receives a StepUpChallengeInfo object:
Complete a managed OTP step
When the current step isverify_sms or verify_email, use the OTP methods with the challengeId from onChallenge:
Complete a custom step
For custom steps (e.g.kyc_review), your backend issues a verification token after the user completes the step on your side. Pass it to the SDK:
challenge_id from the verification token, retrieves the cached challenge token, and sends both to Prelude.
Automatic completion
When the last step is completed, the SDK automatically:- Refreshes the session with the challenge token
- Clears the step-up cache for that challenge
- Calls your
onChallengecallback withcurrentStep: "completed"
client.refresh() will include the granted scope. No manual refresh call is needed.
Try it
Try it
This example builds on the project from Introduction. Make sure you have a working OTP login first (OTP Login).1. Create a mock hookGo to mockerapi.com and create a new mock API that returns the following JSON on Copy the generated mock URL (e.g. 3. Add the scopeRegister the scope on your application:4. Replace Run
POST:https://free.mockerapi.com/mock/xxxxxxxx).2. Configure step-upCreate a step-up configuration pointing to your mock hook. The jwks_url can be any valid URL since we only use managed steps here:src/App.jsxsrc/App.jsx
npm run dev, log in with your phone number, then click Request transfer:write scope. You’ll receive a second OTP to complete the step-up challenge. After verification, the access token will include the transfer:write scope.