B2B Saas Authentication

/

Frontend SDKs

/

Headless

/

Members

/

Update Self

Update Self

The Update Self method wraps the Update Member API endpoint. The organization_id and member_id will be automatically inferred from the logged-in Member's session. This method can be used to update only the logged-in Member.

You can listen for successful Member updates anywhere in the codebase with the stytch.organization.onMemberChange() method or useStytchMember hook if you are using React.


Method parameters


namestring

untrusted_metadataobject

mfa_phone_numberstring

mfa_enrolledboolean

default_mfa_methodstring
import { useStytchB2BClient } from '@stytch/react/b2b';

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

  const updateName = () => {
    stytch.self.update({
      name: 'Jane Doe',
    });
  };

  return <button onClick={updateName}>Update name</button>;
};

RESPONSE

200
{
  "status_code": 200,
  "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
  "member_id": "member-test-32fc5024-9c09-4da3-bd2e-c9ce4da9375f",
  "member": {...},
  "organization": {...}
}