User Account Management

Last Updated on : 2024-05-15 09:38:01download

Tuya Cube App SDK supports multiple types of user accounts, such as mobile phone numbers, email addresses, and app UIDs.

Account types

Different types of accounts support the following specific capabilities:

  • An account that is registered with a mobile phone number supports two login methods: verification code login and password login.

  • An account that is registered with an email address supports password login.

  • An app UID applies to existing account systems.

  • Third-party login supports login with an authorized account of a third-party platform, such as Facebook and Twitter.

  • Anonymous login provides a quick login method. Anonymous users can provide detailed user information to get a registered account.

Functional description

  • To implement registration methods, you must set the countryCode parameter to specify the country code. This way, the data center closest to users’ location can be selected to serve workloads in the Tuya IoT Cloud.

    The data in different data centers is isolated from each other. For example, an account that is registered in America (1) cannot be used in mainland China (86). Otherwise, an error message is returned to indicate that the account does not exist. For more information, see Data center.

  • In this tutorial, the User object is frequently called. This object is a singleton that stores all data of the current user including login and registration methods. The following table describes the data model of the object.

    Field Description
    headPic The URL of the user avatar.
    nickName The nickname of the user.
    username The username.
    • If an account is registered with a mobile phone number, the username is a mobile phone number.
    • If an account is registered with an email address, the username is an email address.
    mobile The mobile phone number.
    email The email address of the user.
    phoneCode The country code. Example:
    • 86: China
    • 1: the United States of America (USA)
    Domain.regionCode The data center to which the current account belongs. Example:
    • AY: China
    • AZ: the USA
    • EU: Europe
    timezoneId The time zone ID. Example: Asia/Shanghai.
    tempUnit The temperature unit. Valid values:
    • 1: temperature in Celsius (°C)
    • 2: temperature in Fahrenheit (°F)
    snsNickname The nickname of a third-party account.
    regFrom The type of registration. Valid values:
    • 0: email address
    • 1: mobile phone number
    • 2: other registration methods
    • 3: Tencent QQ
    • 5: Facebook
    • 6: Twitter
    • 7: WeChat
    • 9: app UID
    • 10: Google