Auth0 Node.js SDK - v5.0.0
    Preparing search index...
    Index

    Accessors

    Constructors

    Methods

    • Update a user.

      These are the attributes that can be updated at the root level:

      • app_metadata
      • blocked
      • email
      • email_verified
      • family_name
      • given_name
      • name
      • nickname
      • password
      • phone_number
      • phone_verified
      • picture
      • username
      • user_metadata
      • verify_email

      Some considerations:

      • The properties of the new object will replace the old ones.
      • The metadata fields are an exception to this rule (user_metadata and app_metadata). These properties are merged instead of being replaced but be careful, the merge only occurs on the first level.
      • If you are updating email, email_verified, phone_number, phone_verified, username or password of a secondary identity, you need to specify the connection property too.
      • If you are updating email or phone_number you can specify, optionally, the client_id property.
      • Updating email_verified is not supported for enterprise and passwordless sms connections.
      • Updating the blocked to false does not affect the user's blocked state from an excessive amount of incorrectly provided credentials. Use the "Unblock a user" endpoint from the "User Blocks" API to change the user's state.
      • Supported attributes can be unset by supplying null as the value.
      Updating a field (non-metadata property)
      To mark the email address of a user as verified, the body to send should be:
      { "email_verified": true }
      Updating a user metadata root property
      Let's assume that our test user has the following user_metadata:
      { "user_metadata" : { "profileCode": 1479 } }

      To add the field addresses the body to send should be:

      { "user_metadata" : { "addresses": {"work_address": "100 Industrial Way"} }}

      The modified object ends up with the following user_metadata property:

      {
      "user_metadata": {
      "profileCode": 1479,
      "addresses": { "work_address": "100 Industrial Way" }
      }
      }

      Updating an inner user metadata property
      If there's existing user metadata to which we want to add "home_address": "742 Evergreen Terrace" (using the addresses property) we should send the whole addresses object. Since this is a first-level object, the object will be merged in, but its own properties will not be. The body to send should be:
      {
        "user_metadata": {
          "addresses": {
            "work_address": "100 Industrial Way",
            "home_address": "742 Evergreen Terrace"
          }
        }
      }

      The modified object ends up with the following user_metadata property:

      {
        "user_metadata": {
          "profileCode": 1479,
          "addresses": {
            "work_address": "100 Industrial Way",
            "home_address": "742 Evergreen Terrace"
          }
        }
      }

      Parameters

      Returns HttpResponsePromise<UpdateUserResponseContent>

    • Returns Promise<string>

    Properties

    _options: Users.Options
    _authenticationMethods: undefined | AuthenticationMethods
    _authenticators: undefined | Authenticators
    _enrollments: undefined | Enrollments
    _federatedConnectionsTokensets: undefined | FederatedConnectionsTokensets
    _groups: undefined | Groups
    _identities: undefined | Identities
    _logs: undefined | Logs
    _multifactor: undefined | Multifactor
    _organizations: undefined | Organizations
    _permissions: undefined | Permissions
    _riskAssessments: undefined | RiskAssessments
    _roles: undefined | Roles
    _refreshToken: undefined | RefreshToken
    _sessions: undefined | Sessions