Username Account
A username account uses a username and password for login or registration.
Login
import { GizSDKManager } from '@gizwits/smart-sdk';
const userManager = GizSDKManager.getUserManager();
await userManager.loginWithAccount(username, password);An empty username or password throws GizOpenApiError. After login, the SDK refreshes the user profile and cloud-bound devices.
Register
const token = await userManager.registerWithAccount(username, password);
userManager.updateAuthorizeData(token);Registration returns authorization data without implicitly replacing the current user. Apply it with updateAuthorizeData() or log in according to the application's flow.