Skip to main content

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 is verify_sms or verify_email, use the OTP methods with the challengeId from onChallenge:
If the user didn’t receive the code:

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:
The SDK extracts the 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:
  1. Refreshes the session with the challenge token
  2. Clears the step-up cache for that challenge
  3. Calls your onChallenge callback with currentStep: "completed"
The new access token from client.refresh() will include the granted scope. No manual refresh call is needed.
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 POST:
Copy the generated mock URL (e.g. 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:
3. Add the scopeRegister the scope on your application:
4. Replace src/App.jsx
src/App.jsx
Run 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.