Skip to content
Discussion options

You must be logged in to vote

Is it possible to initiate a OTP request from pocketbase (js)? I was looking for something like record.createNewOtp() I did find newOTP interface but that seems to be go-only?

There is no binding for core.NewOTP in the JSVM at the moment but I'm not sure if it is really necessary.

core.OTP is a typed Go proxy struct with some helper methods like HasExpired but under the hood it is a regular Record, meaning that you can create it on your own. This could look something like:

const user = ...

// generate a password similar to the default one
// OR if you are using it as a "magic link" change it to something more complex 
const otpPassword = $security.randomStringWithAlphabet(user.collection(

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@einarpersson
Comment options

@ganigeorgiev
Comment options

Answer selected by einarpersson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants