The TOTP Create method wraps the create endpoint. Call this method to create a TOTP registration on an existing Member.
TOTP Create
Method parameters
organization_id* string
member_id* string
expiration_minutes int
import { useStytchB2BClient } from '@stytch/react/b2b';
import { useCallback } from 'react';
export const CreateTOTP = () => {
const stytch = useStytchB2BClient();
const trigger = useCallback(() => {
stytch.totp.create({
expiration_minutes: 60,
member_id: 'member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f',
organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
});
}, [stytch]);
return <button onClick={trigger}>Create TOTP</button>;
};
RESPONSE
200
{
"status_code": 200,
"request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
"secret": "BTGNX5RKJRMQWQFRQKTG34JCF6XDRHZS",
"totp_id": "totp-test-41920359-8bbb-4fe8-8fa3-aaa83f35f02c",
"qr_code": "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAMgAAADIEAAAAADYoy0BAAAG8ElEQVR...8EAAD//7dQP/5Y00bRAAAAAElFTkSuQmCC",
"recovery_codes": [
"ckss-2skx-ebow",
"spbc-424h-usy0",
"hi08-n5tk-lns5",
"1n6i-l5na-8axe",
"aduj-eufq-w6yy",
"i4l3-dxyt-urmx",
"ayyi-utb0-gj0s",
"lz0m-02bi-psbx",
"l2qm-zrk1-8ujs",
"c2qd-k7m4-ifmc"
]
"member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
"member": {...},
}