Skip to main content
import { Text } from 'react-native';
import { useStytchB2BClient } from '@stytch/react-native/b2b';

export const GetSelfSync = () => {
  const stytch = useStytchB2BClient();

  // Get cached member data synchronously
  const member = stytch.self.getSync();

  return (
    <Text>
      {member ? `Member: ${member.name}` : 'No member found'}
    </Text>
  );
};
{
  "organization_id": "organization-test-07971b06-ac8b-4cdb-9c15-63b17e653931",
  "member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "email_address": "sandbox@stytch.com",
  "email_address_verified": true,
  "retired_email_addresses": ["old@stytch.com"],
  "status": "active",
  "name": "Test User",
  "is_breakglass": false,
  "member_password_id": "member-password-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "mfa_enrolled": false,
  "mfa_phone_number": null,
  "mfa_phone_number_verified": false,
  "default_mfa_method": "sms_otp",
  "totp_registration_id": "totp-registration-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "oauth_registrations": [],
  "sso_registrations": [],
  "roles": [],
  "trusted_metadata": {},
  "untrusted_metadata": {},
  "created_at": "2023-01-01T00:00:00Z",
  "updated_at": "2023-01-01T00:00:00Z"
}
The Stytch SDK stores the currently logged-in in local storage. self.getSync is a synchronous method that fetches the currently logged-in from local storage.
Before using this method, enable in the Frontend SDK page.
If there is no cached data, this method will return null. If you need to asynchronously fetch guaranteed-fresh data from the API, use the self.get method.

Response

organization_id
string
Globally unique UUID that identifies a specific Organization.
member_id
string
Globally unique UUID that identifies a specific Member.
external_id
string
The ID of the Member given by the identity provider.
email_address
string
The email address of the Member.
email_address_verified
boolean
Whether or not the Member’s email address is verified.
status
string
The status of the Member. The possible values are: pending, invited, active, or deleted.
name
string
The name of the Member.
sso_registration
object[]
An array of registered SAML Connection or OIDC Connection objects the Member has authenticated with.
scim_registration
object
Sets whether the Member is enrolled in MFA.
is_breakglass
boolean
Identifies the Member as a break glass user - someone who has permissions to authenticate into an Organization by bypassing the Organization’s settings.A break glass account is typically used for emergency purposes to gain access outside of normal authentication procedures. Refer to the Organization object and its auth_methods and allowed_auth_methods fields for more details.
member_password_id
string
Globally unique UUID that identifies a Member’s password.
oauth_registrations
object[]
A list of OAuth registrations for this Member.
mfa_enrolled
boolean
Sets whether the Member is enrolled in MFA.If true, the Member must complete an MFA step whenever they wish to log in to their Organization.If false, the Member only needs to complete an MFA step if the Organization’s MFA policy is set to REQUIRED_FOR_ALL.
mfa_phone_number
string
The Member’s phone number. A Member may only have one phone number.The phone number should be in E.164 format (i.e. +1XXXXXXXXXX).
mfa_phone_number_verified
boolean
Whether or not the Member’s phone number is verified.
retired_email_addresses
object[]
A list of retired email addresses for this Member. A previously active email address can be marked as retired in one of two ways:
  • It’s replaced with a new primary email address during an explicit Member update.
  • A new email address is surfaced by an OAuth, SAML or OIDC provider. In this case the new email address becomes the Member’s primary email address and the old primary email address is retired. A retired email address cannot be used by other Members in the same Organization. However, unlinking retired email addresses allows them to be subsequently re-used by other Organization Members. Retired email addresses can be unlinked using the Unlink Retired Email endpoint.
trusted_metadata
object
An arbitrary JSON object for storing application-specific data or identity-provider-specific data.
untrusted_metadata
object
An arbitrary JSON object of application-specific data. These fields can be edited directly by the frontend SDK, and should not be used to store critical information. See the Metadata resource for complete field behavior details.
roles
object[]
Explicit or implicit Roles assigned to this Member, along with details about the role assignment source. See the RBAC guide for more information about role assignment.
is_admin
boolean
Whether or not the Member has the stytch_admin Role. This Role is automatically granted to Members who create an Organization through the discovery flow. See the RBAC guide for more details on this Role.
created_at
string
The date and time the Member was created.
updated_at
string
The date and time the Member was last updated.