English
English
简体中文
Contact Us
Register
Log In
layoutIndex

Account Management

Last Updated on : 2022-02-17 05:18:49download

Business license account system

Terminology Meaning
Brand Account This account does not support registration
This account will be bound to the corresponding OEM SaaS login domain, the master account provided when purchasing OEM SaaS from Tuya.
Enterprise master account The accounts registered by developers independently are all enterprise master accounts, which have all privileges within the enterprise and can create/delete projects.
Enterprise sub-account SaaS side login to the enterprise master account can create enterprise sub-account, assign privileges to it, and can limit access to specific functions.

Register

The function of main account registration on app side is not supported for now, you need to open enterprise main account in SaaS platform.

Login

The account system is designed as a model where one account corresponds to multiple merchants. However, the current commercial lighting restriction is one-to-one, and one account only corresponds to one unique merchant. So there is no need to pass in the merchant code when logging in, and the backend can query the unique merchant corresponding to the current account.

Login methods support.

  1. Account password login

  2. Account Verification Code Login

  3. Three-party system authorization login: This method needs to be used with Commercial Lighting Cloud API

Account Management

Authorization process

  1. The server side of the three-party system authorizes the account to Toodle Cloud, and the three-party system decides the scope of the authorized account, which can be a user or employee account of the three-party system, or any internal business form corresponding to an account authorized to Toodle Cloud. For example: enterprise, store, project, etc.
  2. For accounts that have been authorized, the tripartite system server side generic account plus country code to apply for a ticket to Tuya Cloud.

Usage Scenarios

  1. The system domain name of Tuya plus this ticket can be used to achieve a login-free jump. Example: lighting.console.tuyacn.com?ticket=xxx. e.g.: visit Toodleberry’s system website, or scan the code to access the device control h5 page. 2.
  2. Toodle merchant lighting sdk get session interface, pass in ticket, get session status, access full sdk capability.
- (void)loginMerchantByTicket:(nonnull NSString*)ticket
         multiMerchantHanlder:(void(^_Nullable)(NSArray<TuyaSmartMerchantModel *> * _Nonnull merchantInfos))multiMerchantHanlder
                      success:(nullable TYSuccessHandler)success
                      failure:(nullable TYFailureError)failure;

Parameter Description

parameter description
ticket [get ticket by authorization process](# https://developer.tuya.com/en/docs/iot/account?id=Kadobk0jt99au#title-4-%E8%8E%B7%E5%8F%96%E7%99%BB%E5%BD%95%20ticket)

Sample code

- (IBAction)logintAction:(id)sender {
    
    [[TuyaSmartUser sharedInstance] loginMerchantByTicket:@"HgM1qbQjitmZ5zjd" multiMerchantHanlder:^(NSArray<TuyaSmartMerchantModel *> * _Nonnull merchantInfos) {
        
    } success:^{
       
    } failure:^(NSError *error) {
        
    }];
}

Retrieve password / reset password

This scenario is applicable when you forget your password: you need to retrieve it/reset it. The steps are the same for both, but you need to verify the permission before querying the merchant list.
So it is divided into three steps, first get the verification code for password recovery, pass the verification code into the list of merchants, get the corresponding individual merchants to perform the password recovery party to change the password.

View instructions for use

Account Logout

Account basic information storage/clearing are handled internally in sdk, so developers don’t need to care about the security and synchronization of account information.
After successful login, sdk will cache the basic account information, and after successful logout, sdk will also clear the current account cache data, so developers only need to handle their own business logic after successful callbacks.

View instructions for use

Account cancellation

Enterprise master account does not support account cancellation function at the moment, please submit work orders in IOT platform for manual review

Account binding

At present, the merchant account system does not support the function of setting binding information for the account.
For example, the account registered by cell phone number is bound to mailbox, or the account registered by mailbox is bound to cell phone number.

Query user information

Account inherent attributes (account name, account role, etc.) will be returned as account attributes after successful login, while user additional attributes (nickname, avatar, etc.) will not be returned after successful login, and need to be accessed through Get User Information for additional queries.

Also Get user information can be used in the scenario of performing multi-end data synchronization, where the other end modifies additional user attributes and synchronizes the latest data through this method.

Modify user information

Commercial lighting business currently supports Modify user avatar and modify nickname, both only need to handle UI logic, subsequent data caching and so on are handled inside the sdk, no additional synchronization is needed by the developer.

This section contains the following topics to help you quickly understand related concepts and how-to guides: