> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get User Sync

> Get the currently logged-in User from local storage using the Stytch React SDK

> [!NOTE]
>
> In React, use the [`useStytchUser`](../../hooks/use-stytch-user) hook to access the logged-in User and react to changes.

The Stytch SDK caches the currently logged-in user. `user.getSync` is a synchronous method that fetches the currently logged-in User from the cache.

If there is no cached data, this method returns `null`.

The `user.getInfo` method is similar to `user.getSync`, but returns an object containing the `user` object and a `fromCache` boolean. If `fromCache` is true, the user object is from the cache and a state refresh is in progress.

You can listen for changes with the `user.onChange` method, which invokes your callback whenever the user object changes.

If you need to asynchronously fetch guaranteed-fresh data from the API, use the [`user.get`](./get-user) method.

## Response

**user** `object`

See the [User object](https://stytch.com/docs/api-reference/consumer/api/users/user-object.md) for complete response field details.

**properties**

**created\_at** `string`

The timestamp of the User's creation. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. 2021-12-29T12:33:09Z.

**crypto\_wallets** `array[objects]`

An array contains a list of all crypto wallets for a given User in the Stytch API.

**properties**

**crypto\_wallet\_id** `string`

The unique ID for a crypto wallet

**crypto\_wallet\_address** `string`

The actual blockchain address of the User's crypto wallet.

**crypto\_wallet\_type** `string`

The blockchain that the User's crypto wallet operates on, e.g. Ethereum, Solana, etc.

**verified** `boolean`

If this method has been successfully authenticated by the User.

**emails** `array[objects]`

An array of email objects for the User.

**properties**

**email\_id** `string`

The unique ID of a specific email address.

**email** `string`

The email address.

**verified** `boolean`

If this method has been successfully authenticated by the User.

**name** `object`

The name of the User. Each field in the name object is optional.

**properties**

**first\_name** `string`

The first name of the user.

**middle\_name** `string`

The middle name(s) of the user.

**last\_name** `string`

The last name of the user.

**trusted\_metadata** `object`

The trusted\_metadata field contains an arbitrary JSON object of application-specific data. See the [Metadata](https://stytch.com/docs/api-reference/consumer/api/resources/metadata.md) reference for complete field behavior details.

**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](https://stytch.com/docs/api-reference/consumer/api/resources/metadata.md) reference for complete field behavior details.

**phone\_numbers** `array[objects]`

An array of phone number objects linked to the User.

**properties**

**phone\_id** `string`

The unique ID for the phone number.

**phone\_number** `string`

The phone number.

**verified** `boolean`

If this method has been successfully authenticated by the User.

**providers** `array[objects]`

An array of OAuth provider objects linked to the User.

**properties**

**oauth\_user\_registration\_id** `string`

The unique ID for an OAuth registration.

**provider\_subject** `string`

The unique identifier for the User within a given OAuth provider. Also commonly called the "sub" or "Subject field" in OAuth protocols.

**provider\_type** `string`

Denotes the OAuth identity provider that the user has authenticated with, e.g. Google, Facebook, GitHub etc.

**profile\_picture\_url** `string`

If available, the profile\_picture\_url is a url of the User's profile picture set in OAuth identity the provider that the User has authenticated with, e.g. Facebook profile picture.

**locale** `string`

If available, the locale is the User's locale set in the OAuth identity provider that the user has authenticated with.

**password** `object`

The password object is returned for users with a password.

**properties**

**password\_id** `string`

The unique ID of a specific password

**requires\_reset** `boolean`

Indicates whether this password requires a password reset

**status** `string`

The status of the User. The possible values are `pending` and `active`.

**totps** `array[objects]`

An array containing a list of all TOTP instances for a given User in the Stytch API.

**properties**

**totp\_id** `string`

The unique ID for a TOTP instance.

**verified** `boolean`

If this method has been successfully authenticated by the User.

**user\_id** `string`

The unique ID of the affected User.

**webauthn\_registrations** `array[objects]`

An array that contains a list of all Passkey or WebAuthn registrations for a given User in the Stytch API.

**properties**

**webauthn\_registration\_id** `string`

The unique ID for the Passkey or WebAuthn registration.

**domain** `string`

The domain on which Passkey or WebAuthn registration was started. This will be the domain of your app.

**user\_agent** `string`

The user agent of the User.

**authenticator\_type** `string`

The authenticator\_type string displays the requested authenticator type of the Passkey or WebAuthn device. The two valid types are "platform" and "cross-platform". If no value is present, the Passkey or WebAuthn device was created without an authenticator type preference.

**verified** `boolean`

If this method has been successfully authenticated by the User.

**name** `string`

The name of the Passkey or WebAuthn registration.

**biometric\_registrations** `array[objects]`

An array that contains a list of all biometric registrations for a given User in the Stytch API.

**properties**

**biometric\_registration\_id** `string`

The unique ID for a biometric registration.

**verified** `boolean`

If this method has been successfully authenticated by the User.

**roles** `array[strings]`

Roles assigned to this User. See the [RBAC guide](https://stytch.com/docs/consumer-auth/authorization/assigning-roles-to-users.md) for more information about role assignment.

**fromCache** `boolean`

Whether the User data is from persistent storage.

```jsx theme={null}
import { useStytch } from '@stytch/react';

export const UserDisplay = () => {
  const stytch = useStytch();
  const user = stytch.user.getSync();

  return user ? <p>User: {user.name.first_name}</p> : <p>No user found</p>;
};
```

```json theme={null}
{
  "user_id": "user-test-16d9ba61-97a1-4ba4-9720-b03761dc50c6",
  "emails": [
    {
      "email_id": "email-test-81bf03a8-86e1-4d95-bd44-bb3495224953",
      "email": "sandbox@stytch.com",
      "verified": true
    }
  ],
  "phone_numbers": [],
  "crypto_wallets": [],
  "name": {
    "first_name": "Jane",
    "last_name": "Doe"
  },
  "trusted_metadata": {},
  "untrusted_metadata": {},
  "created_at": "2023-01-01T00:00:00Z",
  "status": "active"
}
```
