Skip to main content
  import React, { useCallback } from 'react';
  import { Text, TouchableOpacity, View } from 'react-native';
  import { useStytch } from '@stytch/react-native';

  export const Login = () => {
    const stytch = useStytch();

    const updateName = useCallback(() => {
      stytch.user.update({
        name: {
          first_name: 'Jane',
          last_name: 'Doe',
        },
        untrusted_metadata: {
          display_theme: 'DARK_MODE',
        },
      });
    }, [stytch]);

    return (
      <View>
        <TouchableOpacity onPress={updateName}>
          <Text>Update name</Text>
        </TouchableOpacity>
      </View>
    );
  };
{
  "emails": [
    {
      "email_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953",
      "email": "sandbox@stytch.com",
      "verified": false
    }
  ],
  "phone_numbers": [
    {
      "phone_id": "phone-number-test-d5a3b680-e8a3-40c0-b815-ab79986666d0",
      "phone_number": "+12025550162",
      "verified": false
    }
  ],
  "crypto_wallets": [
    {
      "crypto_wallet_id": "crypto-wallet-test-dbbd372e-79f8-48ea-907c-5f0755e7d328",
      "crypto_wallet_address": "0x6df2dB4Fb3DA35d241901Bd53367770BF03123f1",
      "crypto_wallet_type": "ethereum",
      "verified": true
    }
  ],
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "status_code": 200,
  "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
  "user": {...}
}
Wraps the update user endpoint. Use this method to change the user’s name, untrusted metadata, and attributes.
If a user has enrolled another MFA method, this method will require MFA. See the Multi-factor authentication section for more details.

Parameters

name
object
The name of the user. Each field in the name object is optional.
untrusted_metadata
object
The untrusted_metadata field contains an arbitrary JSON object of application-specific data. Untrusted metadata can be edited by end users directly via the SDK, and cannot be used to store critical information. See the Metadata reference for complete field behavior details.

Response

emails
array[objects]
An array of email objects for the User.
phone_numbers
array[objects]
An array of phone number objects linked to the User.
crypto_wallets
array[objects]
An array contains a list of all crypto wallets for a given User in the Stytch API.
user_id
string
The unique ID of the affected User.
user
object
The user object affected by call. See the User object for complete response field details.
request_id
string
Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
status_code
number
The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.