DEV Community

HarmonyOS
HarmonyOS

Posted on

Common Huawei account login error codes and solutions

Read the original article:Common Huawei account login error codes and solutions

Common Huawei Account Login Error Codes And Solutions

Problem Description

Huawei account login error, the common error code is 1001500001, the main error information is as follows:

Failed to auth, errorCode=1001500001, errorMsg=Failed to check the fingerprint of the app bundle.Fingerprint verification error。
Enter fullscreen mode Exit fullscreen mode

The error code is 1001502014, and the main error information is as follows:

 Failed to auth. Code: 1001502014, message: The app does not have the required scopes or permissions.no scope permission。
Enter fullscreen mode Exit fullscreen mode

Background Knowledge

After connecting to the app using a Huawei account and following the development documentation to enable one-click login with a Huawei account, I'm unable to log in with my Huawei account or receive an error message. Other common Huawei account service error codes are as follows:

Error Code ID Error Message Overview
1001500001 Failed to check the fingerprint of the app bundle.
1001500002 This error code is reported when a request is already being processed.
1001500003 The scopes or permissions are not supported.
1001500004 The account does not support this function.
1001502014 The app does not have the required scopes or permissions.
1001502003 Invalid input parameter value.

Solution

The meaning of error code 1001500001 is that the application fingerprint certificate verification has failed. Possible reasons: the application's fingerprint certificate is not configured or is configured incorrectly.
Troubleshooting and localization approach:

Is the Client ID configured incorrectly:
Check if the clientId in the module.json5 file under the module with module type as entry is configured incorrectly. Please refer to the configuration of Client ID.
Note: The path to obtain the client_id here is: AGC's General -> Application -> OAuth 2.0 Client ID (Credentials -> Client ID).
In the module.json5 file of the entry module in the project, add metadata, configure the name as client_id, and the value as the value of the Client ID.
Error Example 1: The client_id is not configured in the project.
Error Example 2: Writing the value of client_id inside a string (e.g., "value": "$string:clientId") will also cause authorization errors.
Error Example 3: The value of client_id is configured as APP ID instead of the value of Client ID.
Error Example 4: Multiple client_ids are configured in module.json5.

Check whether the app's signing certificate fingerprint is configured correctly. You can add the public key fingerprint and check the app signature as described in the documentation. Refer to the document: (Configuring the App Signing Certificate Fingerprint). Error Example 1: The public key fingerprint is not added to AppGallery Connect. Error Example 2: Adding the certificate fingerprint directly to AppGallery Connect is incorrect. Adding the public key fingerprint is required for HarmonyOS API 9 and above. Error Example 3: The certificate configured in the local project is different from the SHA256 certificate/public key fingerprint used in AppGallery Connect.

In File -> Project Structure... -> Project -> Signing Configs, do not check "Automatically generate signature" for automatic signing. You must manually configure the signature. You can follow the instructions in Development Preparation: Configuring Signature Information.

If it is a network problem, you can check whether there is a problem with the device network. You can change the network, such as switching to mobile network or WIFI and try again to see if it works.

After adding a public key fingerprint on AppGallery Connect (HarmonyOS API 9 and above), the fingerprint is cached for a certain period of time and does not take effect immediately. It is recommended that you wait half an hour after configuration before trying again.

Check to see if your phone's system time has been modified. This is not recommended. If the issue is still not found after completing the above steps, try the following troubleshooting: After installing the app (Windows):

hdc shell bm dump -n package_name | findstr appId
Enter fullscreen mode Exit fullscreen mode

After installing the app (Mac):

hdc shell bm dump -n package_name | grep appId
Enter fullscreen mode Exit fullscreen mode

Copy the string after the underscore in the package name in "appId" to a new file (you can define the file name yourself, for example, SHA.txt). Then execute the following command to obtain the public key fingerprint. Then compare it with the one configured on the AppGallery Connect to see if they are consistent.

certutil -hashfile F:\\SHA.txt SHA256
Enter fullscreen mode Exit fullscreen mode

If the compared appId is inconsistent, you need to re-apply for the public key fingerprint certificate to configure the application signature fingerprint certificate.

The meaning of error code 1001502014 is that the application has not requested scopes or permissions.
Possible causes and solutions: Please refer to the Account Kit FAQ 1001502014 for possible causes and solutions regarding the application not requesting scopes or permissions here.

Error code 1001502003 means the input parameter value is invalid. Possible causes:

  1. The client_id configuration is incorrect. Refer to the troubleshooting method in the previous section "Whether the Client ID is configured incorrectly."
  2. The anonymous mobile number passed in is incorrect, or the authorization API (AuthorizationWithHuaweiIDRequest) is not called to obtain the anonymous mobile number.

FAQ

Q: What is the purpose of configuring certificate fingerprints on AGC?
A: Configuring certificate fingerprints on the AppGallery Connect (AGC) platform is primarily to ensure the security and integrity of the application.
By configuring certificate fingerprints, the AGC platform can check for any tampering or damage to the application after it is released, thereby protecting the integrity of the application's code.
Security of inter-app transitions: In scenarios where applications transition between each other, configuring certificate fingerprints can help establish secure transition links, preventing risks such as man-in-the-middle attacks and counterfeit applications.
Therefore, configuring certificate fingerprints is an important step in maintaining application security and user trust. Developers need to ensure that certificate fingerprints are correctly configured and used on the AGC platform to enhance the security and user experience of the application.
Q: The Huawei account user authentication protocol in the sample code failed.

Span('Huawei Account User Authentication Agreement').fontcolor($r('app.color.color_337DFF')).onclick(async()=>{
  this.toPrivacy("https://privacy.consumer.huawei.com/legal/id/authentication-terms.htm?code=CN")
})
Enter fullscreen mode Exit fullscreen mode

A: The link for the Huawei account user authentication agreement has changed. You need to add &language=zh-CN after the previous link.
Q: The app can be successfully logged in using a local debug certificate, but fails to log in after replacing it with the official certificate and packaging the APP.
A: The package signed with the release certificate cannot be debugged and installed locally. The APP packaged with the release certificate and corresponding profile can only be used for publishing. The official package can be verified through an invitation testing method.
Q: When adding a new HarmonyOS application, the client_id and client_secret are different from the original ones. How to distinguish whether the incoming Authorization Code is for HarmonyOS or Android?
A: When the server processes the Authorization Code, it must use the corresponding application's Client ID/Secret combination to exchange for an Access Token. At this time:

  1. If you successfully exchange a token using the Client ID/Secret of a HarmonyOS application, the token is determined to be from HarmonyOS.

  2. If you successfully exchange a token using the Android app's Client ID/Secret, the app is considered to be from Android.

Q: Huawei account one-click login to obtain public key fingerprint error: Failed to login with LoginWithHuaweiIDButton. errorCode=1001500001, errorMsg is Failed to check the fingerprint of the app bundle. Incomplete response information from gateway.

kbs--5432048ff4a0435dbeee20af1fa65c80-f3e6.png

A: First, check if you are an enterprise developer, as personal developers are not currently supported for one-click login. Then, follow the current knowledge solution approach to troubleshoot step by step.
Q: Why can't I use the Huawei account to purchase the project sharing feature in the phone settings on HarmonyOS 5.0 and HarmonyOS 6.0?
A: Currently, HarmonyOS 5.0 and 6.0 do not support the project sharing purchase feature. It is planned to be supported in version 6.1.

Written by Recep Sadullah Yegin

Top comments (0)