B2B Saas Authentication

/

Mobile SDKs

/

React Native SDK reference

/

Multi-factor Authentication

/

Time-Based One-Time Passcodes

/

TOTP Create

TOTP Create

The TOTP Create method wraps the create endpoint. Call this method to create a TOTP registration on an existing Member.


Method parameters


organization_id*string

member_id*string

expiration_minutesint

Response fields


request_idstring

status_codeint

secretstring

totp_registration_idstring

qr_codestring

recovery_codesarray[strings]

member_idstring

memberobject
import React, { useCallback } from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import { useStytchB2BClient } from '@stytch/react/b2b';

export const Create = () => {
  const stytch = useStytchB2BClient();
  const createTOTP = useCallback(() => {
    stytch.totp.create({
      member_id: 'member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f',
      organization_id: 'organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931',
    });
  }, [stytch]);
  return (
    <View>
      <TouchableOpacity onPress={createTOTP}>
        <Text>Create TOTP</Text>
      </TouchableOpacity>
    </View>
  );
};

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": {...},
}