
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@hmscore/cordova-plugin-hms-account
Advanced tools
The Cordova SDK code encapsulates the Huawei Account Kit interface. It provides many APIs for your reference or use.
Before you get started, you must register as a HUAWEI developer and complete identity verification on the HUAWEI Developer website. For details, please refer to Register a HUAWEI ID.
Creating an app in AppGallery Connect is required in order to communicate with the Huawei services. To create an app, perform the following steps:
A signing certificate fingerprint is used to verify the authenticity of an app when it attempts to access an HMS Core (APK) through the HMS SDK. Before using the HMS Core (APK), you must locally generate a signing certificate fingerprint and configure it in the AppGallery Connect. You can refer to 3rd and 4th steps of Generating a Signing Certificate Codelab tutorial for the certificate generation. Perform the following steps after you have generated the certificate.
Install Cordova CLI.
npm install -g cordova
Create a new Cordova project or use existing Cordova project.
cordova create path [id [name [config]]] [options]
command. For more details please follow CLI Reference - Apache Cordova.Add the Android platform to the project if haven't done before.
cordova platform add android
Install HMS Account Plugin
to the project. You can either install the plugin through npm
or by downloading from HMS Core Plugin page
.
a. Run the following command in the root directory of your project to install it through npm.
cordova plugin add @hmscore/cordova-plugin-hms-account
b. Or download the plugin from Plugin > Account Kit > Cordova Plugin page and run the following command in the root directory of your project to install it manually.
cordova plugin add <hms_cordova_account_plugin_path>
Copy agconnect-services.json
file to <project_root>/platforms/android/app
directory.
Add keystore(.jks)
and build.json
files to your project's root directory.
build.json
file according to your keystore information. For example:{
"android": {
"debug": {
"keystore": "<keystore_file>.jks",
"storePassword": "<keystore_password>",
"alias": "<key_alias>",
"password": "<key_password>"
},
"release": {
"keystore": "<keystore_file>.jks",
"storePassword": "<keystore_password>",
"alias": "<key_alias>",
"password": "<key_password>"
}
}
}
Update the widget id
property which is specified in the config.xml
file. It must be same with client > package_name value of the agconnect-services.json
file.
Run the application.
cordova run android --device
Install Ionic CLI.
npm install -g @ionic/cli
Create a new Ionic project or use existing Ionic project.
ionic start <name> <template> [options]
command. For more details please follow ionic start - Ionic Documentation.Enable the Cordova integration if haven't done before.
ionic integrations enable cordova
Update the widget id
property which is specified in the config.xml
file. It must be same with client > package_name value of the agconnect-services.json
file.
Add the Android platform to the project if haven't done before.
ionic cordova platform add android
Install HMS Account Plugin
to the project. You can either install the plugin through npm
or by downloading from HMS Core Plugin page
.
a. Run the following command in the root directory of your project to install it through npm.
ionic cordova plugin add @hmscore/cordova-plugin-hms-account
b. Or download the plugin from Plugin > Account Kit > Cordova Plugin page and run the following command in the root directory of your project to install it manually.
ionic cordova plugin add <hms_cordova_account_plugin_path>
Copy hms-account folder from node_modules/@hmscore/cordova-plugin-hms-account/ionic/wrapper/dist
directory to node_modules/@ionic-native
directory.
Copy agconnect-services.json
file to <project_root>/platforms/android/app
directory.
Add keystore(.jks)
and build.json
files to your project's root directory.
You can refer to 3rd and 4th steps of Generating a Signing Certificate Codelab tutorial page for generating keystore file.
Fill build.json
file according to your keystore information. For example:
{
"android": {
"debug": {
"keystore": "<keystore_file>.jks",
"storePassword": "<keystore_password>",
"alias": "<key_alias>",
"password": "<key_password>"
},
"release": {
"keystore": "<keystore_file>.jks",
"storePassword": "<keystore_password>",
"alias": "<key_alias>",
"password": "<key_password>"
}
}
}
Run the application.
ionic cordova run android --device
Enable the Capacitor integration if haven't done before.
ionic integrations enable capacitor
Update the widget appId
property which is specified in the capacitor.config.json
file. It must be same with client > package_name value of the agconnect-services.json
file.
Install HMS Account Plugin
to the project. You can either install the plugin through npm
or by downloading from HMS Core Plugin page
.
a. Run the following command in the root directory of your project to install it through npm.
npm install @hmscore/cordova-plugin-hms-account
b. Or download the plugin from Plugin > Account Kit > Cordova Plugin page and run the following command in the root directory of your project to install it manually.
npm install <hms_cordova_account_plugin_path>
Copy hms-account folder from node_modules/@hmscore/cordova-plugin-hms-account/ionic/wrapper/dist
directory to node_modules/@ionic-native
directory.
Build Ionic app to generate resource files.
ionic build
Add the Android platform to the project if haven't done before.
npx cap add android
Copy keystore(.jks)
and agconnect-services.json
files to <project_root>/android/app
directory.
Open the build.gradle
file in the <project_root>/android/app
directory.
signingConfigs
entry to android according to your keystore information.signingConfig
configuration to debug and release flavors.com.huawei.agconnect
plugin....
android {
...
// Add signingConfigs according to your keystore information
signingConfigs {
config {
storeFile file('<keystore_file>.jks')
storePassword '<keystore_password>'
keyAlias '<key_alias>'
keyPassword '<key_password>'
}
}
buildTypes {
debug {
signingConfig signingConfigs.config // Enable signingConfig in debug flavor
}
release {
signingConfig signingConfigs.config // Enable signingConfig in release flavor
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
...
apply plugin: 'com.huawei.agconnect' // Apply com.huawei.agconnect plugin. This line must be added to the end of the file.
Open the build.gradle
file in the <project_root>/android
directory. Add Huawei's maven repositories and agconnect classpath to the file.
buildscript {
repositories {
/*
<Other repositories>
*/
maven { url 'https://developer.huawei.com/repo/' }
}
dependencies {
/*
<Other dependencies>
*/
classpath 'com.huawei.agconnect:agcp:1.4.1.300'
}
}
/*
<Other build.gradle entries>
*/
allprojects {
repositories {
/*
<Other repositories>
*/
maven { url 'https://developer.huawei.com/repo/' }
}
}
Open the project in Android Studio and run it.
npx cap open android
Module | Description |
---|---|
HMSCommonTypes | A module for providing common data types and constants. |
HMSAccount | A module for interacting with the Huawei Sign In API. |
HMSHuaweiIdAuthManager | A module is used to entry point for the Huawei Sign In API. |
HMSHuaweiIdAuthTool | A module for obtaining and clearing authorization information. |
HMSNetworkTool | A module is used to construct a cookie and a url with specific parameters. |
HMSReadSMSManager | A module for Huawei ID SMS Service. |
HMSHuaweiIdAuthButton | A module is used to processing the the visual elements of the button for sign in. |
Return Type | Methods | Definition |
---|---|---|
Promise<AuthHuaweiId> | signIn | This API is called to sign in to the apps with HUAWEI IDs securely. |
Promise<void> | signOut | This API is called to sign out of a HUAWEI ID from an app. |
Promise<void> | cancelAuthorization | This API is called to cancel HUAWEI sign-in authorization. |
Promise<AuthHuaweiId> | silentSignIn | This API is called to silent authorization. The API will not display the related page. |
void | enableLogger | This API is used to activating a logger that is for sending some statistics for the development of functions. |
void | disableLogger | This API is used to disable a logger that is for sending some statistics for the development of functions. |
This API is called for HUAWEI sign-in.
Parameter | Type | Definition |
---|---|---|
signInData | SignInData] | Signin settings. |
Return | Definition |
---|---|
Promise<AuthHuaweiId> | If the operation is successful, promise resolves to a AuthHuaweiId object. Otherwise it throws an error. |
const signInParameters = {
authRequestOption: [HMSCommonTypes.AuthRequestOption.SCOPE_ID_TOKEN],
authParam: HMSCommonTypes.HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM
}
try {
const res = await HMSAccount.signIn(signInParameters);
alert(JSON.stringify(res));
} catch (ex) {
alert(JSON.stringify(ex));
}
{"accessToken":"","displayName":"account@***.com","email":"account@***.com","familyName":"","givenName":"","authorizationCode":"DQB6e3******","avatarUriString":"","expressionTimeSecs":0,"gender":-1,"describeContentsInAuthHuaweiId":0,"status":0,"authorizedScopes":["openid","profile"],"extensionScopes":[],"account":{"type":"com.huawei","name":"account@***.com"}}
This API is called to sign out of a HUAWEI ID from an app. After sign-out, the HMS SDK deletes the cached HUAWEI ID information.
Return | Definition |
---|---|
Promise<void> | If the operation is successful, promise will resolve successfully. Otherwise it throws an error. |
try {
await HMSAccount.signOut();
alert("signOut -> success");
} catch (ex) {
alert('signOut -> Error : ' + JSON.stringify(ex));
}
This API is called to cancel HUAWEI sign-in authorization.
Return | Definition |
---|---|
Promise<void> | If the operation is successful, promise will resolve successfully. Otherwise it throws an error. |
try {
await HMSAccount.cancelAuthorization();
alert("cancelAuthorization -> success");
} catch (ex) {
alert('cancelAuthorization -> Error : ' + JSON.stringify(ex));
}
This API is called to return the information (or error information) about the HUAWEI ID used by a user who has signed in to an app. During this process, no user page will be displayed to the HUAWEI ID user.
Parameter | Type | Definition |
---|---|---|
authParam | HuaweiIdAuthParams | Authorization scope parameter to customize the authorization. |
Return | Definition |
---|---|
Promise<AuthHuaweiId> | If the operation is successful, promise resolves to a AuthHuaweiId object. Otherwise it throws an error. |
try {
const authParam = HMSCommonTypes.HuaweiIdAuthParams.DEFAULT_AUTH_REQUEST_PARAM;
const res = await HMSAccount.silentSignIn(authParam);
alert("silentSignIn -> success :" + JSON.stringify(res));
} catch (ex) {
alert('silentSignIn -> Error : ' + JSON.stringify(ex));
}
{"accessToken":"","displayName":"account@***.com","familyName":"","givenName":"","unionId":"MDEC*****","avatarUriString":"","expressionTimeSecs":0,"openId":"MDF***","gender":-1,"describeContentsInAuthHuaweiId":0,"status":0,"authorizedScopes":["openid","profile"],"extensionScopes":[]}
Enables HMS Logger.
Return | Definition |
---|---|
Promise<void> | If the operation is successful, a logger is activated. Otherwise it throws an error. |
try {
await HMSAccount.enableLogger();
alert("enableLogger -> success");
} catch (ex) {
alert('enableLogger -> Error : ' + JSON.stringify(ex));
Disables HMS Logger.
Return | Definition |
---|---|
Promise<void> | If the operation is successful, a logger is disabled. Otherwise it throws an error. |
try {
await HMSAccount.disableLogger();
alert("disableLogger -> success");
} catch (ex) {
alert('disableLogger -> Error : ' + JSON.stringify(ex));
Return Type | Methods | Definition |
---|---|---|
Promise<void> | addAuthScopes | This API is called to request the permission specified by scopeList from a HUAWEI ID. |
Promise<ContainScopesResult> | containScopes | This API is called to check whether the user with the designated HUAWEI ID has been assigned all permissions specified by scopeList. |
Promise<AuthHuaweiId> | getAuthResultWithScope | This API is called to obtain the AuthHuaweiId instance. |
Promise<AuthHuaweiId> | getAuthResult | This API is called to obtain the latest authorization information. |
This API is called to request the permission specified by scopeList from a HUAWEI ID.
Parameter | Type | Definition |
---|---|---|
requestCode | number | Request Id. |
scopeList | AuthScopeList[] | Authorization scope list. |
Return Type | Definition |
---|---|
Promise<void> | If the operation is successful, promise will resolve successfully. Otherwise it throws an error. |
const scopeList = [HMSCommonTypes.AuthScopeList.EMAIL, HMSCommonTypes.AuthScopeList.PROFILE];
try {
const res = await HMSHuaweiIdAuthManager.addAuthScopes(8888, scopeList);
alert("addAuthScopes -> success " + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('addAuthScopes -> Error : ' + JSON.stringify(ex));
}
This API is called to checks whether the designated HUAWEI ID has been assigned all permissions specified by scopeList.
Parameter | Type | Definition |
---|---|---|
authHuaweiId | AuthHuaweiIdBuilder | Authorized HUAWEI ID information. |
scopeList | AuthScopeList[] | Authorization scope list. |
Return | Definition |
---|---|
Promise<ContainScopesResult> | If the operation is successful, promise resolves to an object that contains boolean result, like {"containScopes": false }. Otherwise it throws an error. |
const authHuaweiId = {
"openId": "MDFQ***",
"uid": "",
"displayName": "+90***",
"photoUrl": "",
"accessToken": "",
"serviceCountryCode": "",
"status": 0,
"gender": HMSCommonTypes.Gender.UNKNOWN,
"serverAuthCode": "",
"unionId": "MDHn***",
"countryCode": "",
"scopes": [HMSCommonTypes.AuthScopeList.EMAIL]
};
const scopeList = [HMSCommonTypes.AuthScopeList.EMAIL, HMSCommonTypes.AuthScopeList.PROFILE];
try {
const res = await HMSHuaweiIdAuthManager.containScopes(authHuaweiId, scopeList);
alert("containScopes -> success " + JSON.stringify(res));
} catch (ex) {
alert('containScopes -> Error : ' + JSON.stringify(ex));
}
{"containScopes": false}
This API is called to obtain the AuthHuaweiId.
Parameter | Type | Definition |
---|---|---|
scopeList | AuthScopeList[] | Authorization scope list. |
Return | Definition |
---|---|
Promise<AuthHuaweiId> | If the operation is successful, promise resolves to a AuthHuaweiId object. Otherwise it throws an error. |
const scopeList = [HMSCommonTypes.AuthScopeList.EMAIL, HMSCommonTypes.AuthScopeList.PROFILE];
try {
const res = await HMSHuaweiIdAuthManager.getAuthResultWithScope(scopeList);
alert("getAuthResultWithScope -> success " + JSON.stringify(res));
} catch (ex) {
alert('getAuthResultWithScope -> Error : ' + JSON.stringify(ex));
}
{"accessToken":"CgB6****","displayName":"account@***.com","familyName":"","givenName":"","idToken":"eyJr***","unionId":"MDE***","avatarUriString":"","expressionTimeSecs":0,"openId":"MDF***","gender":-1,"describeContentsInAuthHuaweiId":0,"status":0,"authorizedScopes":["openid","profile"],"extensionScopes":["profile","email"]}
This API is called to obtain information about the HUAWEI ID used for the previous sign-in and authorization.
Return | Definition |
---|---|
Promise<AuthHuaweiId> | If the operation is successful, promise resolves to a AuthHuaweiId object. Otherwise it throws an error. |
try {
const res = await HMSHuaweiIdAuthManager.getAuthResult();
alert("getAuthResult -> success " + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('getAuthResult -> Error : ' + JSON.stringify(ex));
}
{"accessToken":"CgB***","displayName":"account@****.com","familyName":"","givenName":"","idToken":"eyJ***","unionId":"MDE***","avatarUriString":"","expressionTimeSecs":0,"openId":"MDF***","gender":-1,"describeContentsInAuthHuaweiId":0,"status":0,"authorizedScopes":["openid","profile"],"extensionScopes":[]}
Return Type | Methods | Definition |
---|---|---|
Promise<string> | requestUnionId | This API is called to obtain a unionId. |
Promise<string> | requestAccessToken | This API is called to obtain a token. |
Promise<void> | deleteAuthInfo | This API is called to clear the local cache. |
Obtains a unionId.
Parameter | Type | Definition |
---|---|---|
huaweiAccountName | string | HUAWEI ID Name. |
Return | Definition |
---|---|
Promise<string> | If the operation is successful, promise resolves to a string that contains union id. Otherwise it throws an error. |
try {
const res = await HMSHuaweiIdAuthTool.requestUnionId("account@***.com");
alert("requestUnionId -> success " + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('requestUnionId -> Error : ' + JSON.stringify(ex));
}
"MDE***"
Obtains a token.
Parameter | Type | Definition |
---|---|---|
account | Account | HUAWEI ID for which you need to obtain a token. It contains name and type properties. |
scopeList | AuthScopeList[] | HUAWEI ID authorization scope. |
Return | Definition |
---|---|
Promise<string> | If the operation is successful, promise resolves to a string that contains a access token. Otherwise it throws an error. |
const account = {
"type": "com.huawei.hwid",
"name": "account@***.com"
}
const scopeList = [HMSCommonTypes.AuthScopeList.PROFILE];
try {
const res = await HMSHuaweiIdAuthTool.requestAccessToken(account, scopeList);
alert("requestAccessToken -> success " + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('requestAccessToken -> Error : ' + JSON.stringify(ex));
}
"CgB***"
Clears the local cache.
Parameter | Type | Definition |
---|---|---|
accessToken | string | Token to be clear. |
Return | Definition |
---|---|
Promise<void> | If the operation is successful, promise will resolve successfully. Otherwise it throws an error. |
try {
const res = await HMSHuaweiIdAuthTool.deleteAuthInfo("access_token_info");
alert("deleteAuthInfo -> success " + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('deleteAuthInfo -> Error : ' + JSON.stringify(ex));
}
Return Type | Methods | Definition |
---|---|---|
Promise<string> | buildNetworkCookie | This API is called to construct a cookie by combining input values. |
Promise<string> | buildNetworkURL | This API is called to cookie url based on the domain name and isUseHttps. |
Constructs a cookie by combining input values.
Parameter | Type | Definition |
---|---|---|
cookie | Cookie | It is an object that contains cookieName, cookieValue, domain, path, isHttpOnly, isSecure, maxAge. |
Return | Definition |
---|---|
Promise<string> | If the operation is successful, promise resolves to a string that contains a cookie. Otherwise it throws an error. |
const param = {
"cookieName": "hello",
"cookieValue": "world",
"domain": "www.demo.com",
"path": "/demo",
"isHttpOnly": true,
"isSecure": true,
"maxAge": 10
};
try {
const res = await HMSNetworkTool.buildNetworkCookie(param);
alert("buildNetworkCookie -> success " + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('buildNetworkCookie -> Error : ' + JSON.stringify(ex));
}
"hello=world;HttpOnly;Secure;Domain=www.demo.com;Path=/demo;Max-Age=10"
Returns cookie url based on the domain name and isUseHttps.
Parameter | Type | Definition |
---|---|---|
domainInfo | DomainInfo | The parameter that contains a domain name and isUseHttps info. |
Return | Definition |
---|---|
Promise<string> | If the operation is successful, promise resolves to a string that contains a cookie url. Otherwise it throws an error. |
const params = {
"domain": "www.demo.com",
"isUseHttps": true
};
try {
const res = await HMSNetworkTool.buildNetworkURL(params);
alert("buildNetworkURL -> success " + JSON.stringify(res));
} catch (ex) {
alert('buildNetworkURL -> Error : ' + JSON.stringify(ex));
}
"https://www.demo.com"
Return Type | Methods | Definition |
---|---|---|
Promise<string> | smsVerificationCode | This API is called to enable the service of reading SMS messages until the SMS messages that meet the rules (Timeout five minutes). |
Promise<string> | obtainHashCode | This API is called to obtain hash code. |
With this function, app can automatically retrieve SMS verification codes without requesting the permission of reading SMS messages. In case of get SMS Message, returned the SMS Message.
Return | Definition |
---|---|
Promise<string> | If the operation is successful, promise resolves to a string that contains a content of SMS. Otherwise it throws an error. |
try {
const res = await HMSReadSMSManager.smsVerificationCode();
alert("smsVerificationCode -> success :" + JSON.stringify(res));
console.log(JSON.stringify(res));
} catch (ex) {
alert('smsVerificationCode -> Error : ' + JSON.stringify(ex));
}
"<#> Account Kit Test Verification code is 123456 Wc1***"
Obtains hash code which indicates the hash value generated by the HMS SDK based on app package name to uniquely identify app.
Return | Definition |
---|---|
Promise<string> | If the operation is successful, promise resolves to a string that contains a hash value. Otherwise it throws an error. |
try {
const res = await HMSReadSMSManager.obtainHashCode();
alert("obtainHashCode -> success " + JSON.stringify(res));
} catch (ex) {
alert('obtainHashCode -> Error : ' + JSON.stringify(ex));
}
"W1c***"
Return Type | Methods | Definition |
---|---|---|
void | getHuaweiIdAuthButton | This API is called to creating a specific button for login. |
Authenticates user identities. Note that this class only processes the the visual elements of the button.
Parameter | Type | Definition |
---|---|---|
buttonId | string | Id of div that is used for HuaweiIdAuthButton. |
theme | Theme | Button theme |
colorPolicy | ColorPolicy | Values indicates button colors |
cornerRadius | CornerRadius | Values indicates button corner types |
const edittedButton = "btn_auth_button";
HMSHuaweiIdAuthButton.getHuaweiIdAuthButton(edittedButton,
HMSHuaweiIdAuthButton.Theme.THEME_FULL_TITLE,
HMSHuaweiIdAuthButton.ColorPolicy.COLOR_POLICY_RED,
HMSHuaweiIdAuthButton.CornerRadius.CORNER_RADIUS_LARGE);
Name | Definition |
---|---|
HMSCommonTypes.AuthRequestOption | Provides scopes to request a Huawei ID user. |
HMSCommonTypes.HuaweiIdAuthParams | Provides default HuaweiID authorization parameters. |
HMSCommonTypes.AuthScopeList | Provides authorization scopes. |
HMSCommonTypes.Gender | Provides gender information. |
HMSCommonTypes.ErrorCodes | Provides result codes. |
HMSHuaweiIdAuthButton.Theme | Provides themes to set theme of the button. |
HMSHuaweiIdAuthButton.ColorPolicy | Provides colors to set color of the button. |
HMSHuaweiIdAuthButton.CornerRadius | Provides corner radiueses to set corner radius size of the button. |
Constant Fields | Value | Definition |
---|---|---|
SCOPE_PROFILE | "profile" | Requests a HUAWEI ID user to authorize profile information to an app. |
SCOPE_ID_TOKEN | "idToken" | Requests a HUAWEI ID user to authorize ID token to an app. |
SCOPE_ACCESS_TOKEN | "accessToken" | Requests a HUAWEI ID user to authorize access token to an app. |
SCOPE_EMAIL | "email" | Requests a HUAWEI ID user to authorize email address to an app. |
SCOPE_ID | "id" | Requests a HUAWEI ID user to authorize ID to an app. |
SCOPE_AUTHORIZATION_CODE | "authorizationCode" | Requests a HUAWEI ID user to authorize authorization code to an app. |
Constant Fields | Value | Definition |
---|---|---|
DEFAULT_AUTH_REQUEST_PARAM | "DEFAULT_AUTH_REQUEST_PARAM" | Exposes HuaweiIdAuthParam.DEFAULT_AUTH_REQUEST_PARAM. Default authorization parameter of an AppTouch ID. |
DEFAULT_AUTH_REQUEST_PARAM_GAME | "DEFAULT_AUTH_REQUEST_PARAM_GAME" | Exposes HuaweiIdAuthParam.DEFAULT_AUTH_REQUEST_PARAM_GAME. Default authorization parameter of a game. |
Constant Fields | Value | Definition |
---|---|---|
GAME | "https://www.huawei.com/auth/games" | Value to specify game scope. |
OPENID | "openid" | Value to specify openid scope. |
EMAIL | "email" | Value to specify email scope. |
PROFILE | "profile" | Value to specify profile scope. |
Constant Fields | Value | Definition |
---|---|---|
UNKNOWN | -1 | Unkown |
MALE | 0 | Male |
FEMALE | 1 | Female |
CONFIDENTIAL | 2 | Confidential |
Constant Fields | Value | Definition |
---|---|---|
THEME_NO_TITLE | 0 | Button without any title. |
THEME_FULL_TITLE | 1 | Button with an icon and a title. |
Constant Fields | Value | Definition |
---|---|---|
COLOR_POLICY_BLUE | 0 | Blue button. |
COLOR_POLICY_RED | 1 | Red button. |
COLOR_POLICY_WHITE | 2 | White button. |
COLOR_POLICY_WHITE_WITH_BORDER | 3 | White button with strokes. |
COLOR_POLICY_BLACK | 4 | Black button. |
COLOR_POLICY_GRAY | 5 | Gray button. |
Constant Fields | Value | Definition |
---|---|---|
CORNER_RADIUS_LARGE | -1 | Button with large rounded corners. |
CORNER_RADIUS_MEDIUM | -2 | Button with medium-sized rounded corners. |
CORNER_RADIUS_SMALL | -3 | Button with small rounded corners |
Constant Fields | Value | Definition |
---|---|---|
HuaweiIdAuthException | "503" | An authentication error occurs. |
Field Name | Type | Definition |
---|---|---|
openId | string | openId. |
uid | string | uid. |
displayName | string | Nickname. |
photoUrl | string | Obtains the picture url. |
accessToken | string | Access token. |
serviceCountryCode | string | Service country code. |
status | number | User status. 1: Normal; 2: Dbank suspended; 3: Deregistered, 4: All services are suspended. |
gender | Gender | User Gender. |
scopes | AuthScopeList[] | Authorized scopes. |
serverAuthCode | string | serverAuthCode. |
unionId | string | unionId. |
countryCode | string | Registration country code. |
Field | Type | Definition |
---|---|---|
accessToken | string | Access token. |
displayName | string | Nickname. |
string | Email adress. | |
familyName | string | Family name. |
givenName | string | Given name. |
idToken | string | ID Token |
unionId | string | Union Id |
avatarUriString | string | Profile picture URI |
openId | string | OpenId |
describeContentsInAuthHuaweiId | number | Describe Contents In AuthHuaweiId |
authorizedScopes | string[] | Authorized Scopes |
authorizationCode | string | Authorization Code |
huaweiAccount | Account | Huawei Account |
Field Name | Type | Definition |
---|---|---|
type | string | Type of HUAWEI ID Account. |
name | string | Name of the HUAWEI ID Account. |
Field Name | Type | Definition |
---|---|---|
cookieName | string | Cookie name. |
cookieValue | string | Cookie value. |
domain | string | Cookie domain name. |
path | string | Page path for accessing the cookie. |
isHttpOnly | boolean | Value true indicates that the cookie information is contained only in the HTTP request header and cannot be accessed through document.cookie. |
isSecure | boolean | Value true indicates that the cookie can be transmitted only through HTTPS, and value false indicates that the cookie can be transmitted through HTTP. |
maxAge | number | Cookie lifetime, in seconds. |
Field Name | Type | Definition |
---|---|---|
domain | string | Domain name. |
isUseHttps | boolean | Value true indicates HTTPS, and value false indicates HTTP. |
Field Name | Type | Definition |
---|---|---|
containScopes | boolean | true: The HUAWEI ID has all the permissions specified by scopeArr. false: The HUAWEI ID does not have all the permissions specified by scopeArr. |
Field Name | Type | Definition |
---|---|---|
authRequestOption | AuthRequestOption[] | AuthRequestOption array to customize the authorization. |
authParam | HuaweiIdAuthParams | Authorization scope parameter to customize the authorization. It is optional. |
authScopeList | AuthScopeList[] | AuthScopeList array to customize the authorization. If this value not passed to API, an empty array will be send. It is optional. |
After the service of reading SMS messages is enabled, the SMS message you obtain is as follows:
prefix_flag short message verification code is XXXXXX hash_value
prefix_flag indicates the prefix of an SMS message, which can be <#>, [#], or **. short message verification code is indicates the content of an SMS message, which is user-defined. XXXXXX indicates the verification code. hash_value indicates the hash value generated by the HMS SDK based on your app package name to uniquely identify your app.
Before building the APK, configure the obfuscation configuration file to prevent the HMS Core SDK from being obfuscated.
NOTE: This step is required only if you want to minify and obfuscate your app. By default obfuscation is disabled in Cordova and Ionic apps.
The obfuscation is done by ProGuard. By default, in Cordova and Ionic apps ProGuard is disabled. Even though ProGuard is not available, ProGuard support can be added through 3rd party ProGuard plugins. If ProGuard is enabled in your project, the Huawei Cordova Safety Detect plugin's ProGuard rules need to be added to your project. These rules are as follows:
-ignorewarnings
-keepattributes *Annotation*
-keepattributes Exceptions
-keepattributes InnerClasses
-keepattributes Signature
-keep class com.hianalytics.android.**{*;}
-keep class com.huawei.updatesdk.**{*;}
-keep class com.huawei.hms.**{*;}
-repackageclasses
You can find the sample projects on HMS Core > Examples > Account Kit page.
If you have questions about how to use HMS samples, try the following options:
huawei-mobile-services
.If you run into a bug in our samples, please submit an issue to the GitHub repository.
Huawei Account Kit Cordova Plugin is licensed under the Apache 2.0 license.
FAQs
Huawei Account Cordova Plugin
The npm package @hmscore/cordova-plugin-hms-account receives a total of 15 weekly downloads. As such, @hmscore/cordova-plugin-hms-account popularity was classified as not popular.
We found that @hmscore/cordova-plugin-hms-account demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.