Skip to content

setupTOTPDevice ​

Overview ​

Starts setting up a two-factor device for the signed-in user. For email and sms, the server sends a code to the destination; for totp, it returns the secret and a QR code. Before rejecting with an UnauthorizedError, refetches the current user, so authPendingFlow names the flow that the server now requires.

Signature ​

setupTOTPDevice(payload)

Parameters ​

NameTypeRequiredDescription
payloadobjectyesThe request body.

payload Properties ​

NameTypeRequiredDefaultDescription
destinationstringThe email address or phone number; required for email and sms.
methodstringThe device method: totp, email, or sms.

Returns ​

Promise

For totp, an object whose meta holds totp_secret and totp_svg_data_uri.

Source ​

client/lib/stores/storeUser.js:510