Account Management

Last Updated on : 2024-04-03 10:22:28download

Account types

Type Meaning
Brand owner account Users cannot create this type of account.
The account that you receive upon purchasing the OEM SaaS. It is associated with your OEM SaaS domain.
Enterprise main account The account that you create on your own. It has all privileges within the organization and can create or delete projects.
Enterprise sub-account The account that an enterprise main account creates in their SaaS. It is granted access to specific features.

Create account

Creating a main account on the mobile app is not supported. Go to the Smart Commercial Lighting platform to create an account.

Log in

The account system is designed with the one-to-many model, with one account assigned to multiple merchants. In the commercial lighting scenario, the system is limited to the one-to-one relationship, with one account uniquely assigned to one merchant. There is no need to specify the merchant code for login, because the system can retrieve the unique merchant associated with the current account.

Supported login methods:

Account Management

Authorization process

  1. The third-party server grants an account access to the Tuya IoT Development Platform. The third party specifies the type of account, such as a system or employee account. For example, businesses, stores, and projects.
  2. After authorization, the third-party server uses the account and country code to request a ticket from Tuya.

Scenarios

  • Concatenate the Tuya’s system domain and the ticket to enable login-free redirection, for example, lighting.console.tuyacn.com?ticket=xxx. For example, redirect users to the system website or an H5 page for device control.
  • The Commercial Lighting App SDK gets the session status using the ticket to access all features of the SDK.

API description

void loginByTicket(String ticket, IThingUserResultCallback<User> listener);

Parameter description

Parameter Description
ticket The ticket obtained during the authorization process.

Example

ThingOSUser.getUserInstance().loginByTicket(content, new IThingUserResultCallback<User>() {
    @Override
    public void onSuccess(User user) {
        Log.e(TAG,"Login successful")
    }

    @Override
    public void onError(String code, String error) {
        Log.e(TAG,"Login failed:" + error)
    }
});

Reset password

Reset or recover the password if users forget it. The steps for both operations are identical. Permission is verified before the request for the list of merchants.

  1. Get the verification code for resetting the password.
  2. Pass the verification code to get the list of merchants.
  3. Get the respective merchant and invoke the reset password method to change the password.

For more information, see Recover or Reset Password.

Log out

The SDK manages the storage and deletion of account information, freeing you from taking care of its security and synchronization.

After successful login, the SDK will store the account information in the cache. After users log out, the SDK will clear the cache. You can handle your business logic after a successful callback.

For more information, see Recover or Reset Password.

Delete account

To delete an enterprise main account, submit a service ticket for manual review.

Bind account

Currently, the merchant account system does not support binding an account with a phone number or email address.

Get account information

After a successful login, the account name and role will be returned as the account properties. To get additional properties such as nickname and avatar, invoke the Get User Information method.

The Get User Information method can also be used to sync additional user information between apps.