[Hooks] OnRecordAuthWithOTPRequest behavior
Author: betimCreated Mar 3, 2026Updated Apr 5, 2026
Hi,
I went ahead and implemented a different OTP sequence for my app using the hooks only to find that OnRecordAuthWithOTPRequest does not fire down if the entered code is invalid.
Given that we're still in 0.x version, is it possible to change the behavior so that it fires down instead of checking and returning an error early if the code is incorrect?
This way, a TOTP can be implemented on top instead of in.
In my case:
OnMailerRecordOTPSend intercepts the email (return if mfa=totp)
OnRecordRequestOTPRequest intercepts the code request (return if mfa=totp)
OnRecordAuthWithOTPRequest (if mfa=totp { return otpck(code) } return e.Next())
Regards
Source: pocketbase/pocketbase