Trouble with wix-users-backend.register() + approveByToken() Email Verification Flow in Velo

I’m having trouble with
Implementing a custom registration → email-verification flow using Velo’s backend wix-users-backend.register() and approveByToken() pattern. My code registers the user server-side, sends an “approval” email via emailUser(…), and then (on /post-register?token=…) approves and logs them in. Instead of landing in the “Verify Email” state or successfully emailing my template, I get backend errors like:

  • Not Found: the requested item no longer exists.
  • Frontend “Registration error: Unable to handle the request. Contact the site administrator…”

Working in
Wix Studio (Dev Mode) with Velo code files (.jsw backend modules + page code in a lightbox multi-state).

What I’m trying to do

  1. Register a new member backend-side:

js

CopyEdit

const result = await wixUsersBackend.register(email, password, { contactInfo: { … } });
await wixUsersBackend.emailUser('verifyRegistration', result.user.id, { variables: { verifyLink: `…?token=${result.approvalToken}` } });
  1. Approve them when they click my email link:

js

CopyEdit

const { sessionToken } = await wixUsersBackend.approveByToken(token);
wixUsers.applySessionToken(sessionToken);
  1. Drive this all through a single lightbox with states: registrationverifyEmailStateregistrationSuccess.

What I’ve tried so far

  • Confirmed Require email verification is ON in Site Members settings.
  • Ensured my email-automation template key (verifyRegistration) exactly matches the template in Dashboard.
  • Switched from result.user._id to result.user.id per the UUID requirement.
  • Wrapped emailUser in try/catch to throw clear errors on “Not Found.”
  • Added logging to both backend and frontend to trace the flow.
  • Experimented with using session (Wix Storage) instead of localStorage for tokens.
  • Tried both the built-in authentication.register() OTP flow and the approveByToken() approach.

Extra context

  • Errors:
    • Backend: Not Found: the requested item no longer exists. (on emailUser)
    • Frontend: Registration error: Unable to handle the request…
  • Code snippets and full logs are available upon request—happy to share more detail.
  • I’d like to keep using my existing multi-state lightbox and only tweak as needed for this flow.

Any insights on why emailUser can’t find my template, or how to correctly wire the approval token pattern in Velo, would be hugely appreciated!

This isn’t Wix Support; this is a community forum comprised of fellow Wix users and developers from around the world who voluntarily offer to help other users with the issues they’re facing. So help us help you — the more info you provide, the better we can assist you.

Before creating your own topic, you should first check the API documentation for any updates on the APIs you’re using, and also browse the forum to see if other users have faced similar issues. If you had done that, you would’ve found that the wix-users API you’re using has long been deprecated and replaced by wix-members.

So first, update your entire code to use the new API with the correct modules and syntax, and then check if the issue still persists.