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

Login with Third-Party Account

Last Updated on : 2022-03-03 06:41:31download

Tuya Smart Residence App SDK supports login with a third-party account. To implement this feature, the email address and authorization code of the third-party account must be provided, and the user’s app account must be linked with that account. Then, API methods can be called to enable login.

API description

- (void)loginOrRegisterWithCountryCode:(NSString *)countryCode
                                   uid:(NSString *)uid
                              authCode:(NSString *)authCode
                            createSite:(BOOL)createSite
                               success:(nullable TYSuccessID)success
                               failure:(nullable TYFailureError)failure;

Parameters

Parameter Description
countryCode The country or region code.
uid The email address of the user.
authCode The authorization code generated by the third party.
createSite Specifies whether to create a default site denoted by site.

The user ID (uid) and authorization code (authCode) can be generated based on your custom rules. The Smart Residence App SDK does not place limits on these rules. However, the user ID must be unique and each user ID must match only one authorization code.

Example

[[TuyaSmartUser sharedInstance] loginOrRegisterWithCountryCode:@"1" uid:@"your email" authCode:@"your auth code" createSite:YES success:^(id result) {

} failure:^(NSError *error) {

}];