How to Check and Solve WearEngine issue: Scope unauthorized

ZhangAnmy
Huawei Developers
Published in
3 min readSep 5, 2021

Introduction: When mobile and HarmonyOS watch communicate with each other, sometimes “Scope unauthorized”comes from mobile side. This article will introduce how to check and solve the issue step by step.

The log detail for the issue:

2021-06-07 18:21:14.628 27759-27993/com.test D/WearEngine_DeviceServiceProxy: enter syncCheckConnStatus
2021-06-07 18:21:14.628 27759-27993/com.test D/WearEngine_DeviceServiceProxy: syncCheckConnStatusm DeviceManager is not null.
2021-06-07 18:21:14.740 27759-27759/com.test I/TAG: getBondedDevices task submission error: Scope unauthorized
2021-06-07 18:21:14.740 27759-27759/com.test D/TAG: getAuthClient onFailure Scope unauthorized

There are 6 parts need to check as followings:
Please make sure the wearable device is connected to mobile HiHealth.

  1. On Mobile side, the project code should configure wearable packagename and fingerprint information in below code, please following below link to check the wearable package name and fingerprint are right or not?
    Obtaining a Signing Certificate Fingerprint on the Wearable Device
private static final String WEARABLE_PACKAGE_NAME = "com.huawei.watchdemo";
private static final String WEARABLE_FINGERPRINT = "com.huawei.watchdemo_BAX3A0epnNuCaV7qyEjyldpdWkeRsRDewMU/GZh1QeUnGmtDG0IjW27KwNRmXIm08DMNlEfWt536VnXXXXXXXXX=";

2. On Wearable side, the project code should configure as below, please follow the link Generating a Signing Certificate Fingerprint to check Mobile side fingerprint is correct or not?

private static final String PHONE_PEER_PACKAGE = "com.huawei.anmywatchdemo01";//This is the mobile apk pacakge name,it should be different with wearable package name
private static final String PHONE_FINGERPRINT = "F85488DE205EC95AC98AA4DA45FC6779213196AFDF23E63744F0D77XXXXXXXXX";

3. Check APPID and package name of the Mobile project are same as applied Wearengine service or not. Please following the link in AGC Wear Engine to check them.

4. Check the SHA256 fingerprint configured in AGC Account is same as Mobile project(mobile project name is: com.huawei.anmywatchdemo01) or not

5. Please make sure the SHA256 fingerprint of .jks or .keystore file used in mobile project is same as above.

Use command to get SHA256 fingerprint of .jks file: keytool -list -v -keystore C:\xxx.jks

Note: If developer uses default keystore file of Android, please find the debug.keystore file in folder: C:\Users\$username\.android

6. After check above all the information are correct, if the error “Scope unauthorized” still there. Please following the link Wear Engine FAQs to clear data or reinstall Huawei Health.

Conclusion

This article shows the steps for checking the error “Scope unauthorized” for Wear Engine. Based on above steps, the issue will be solved basically. One of the developers has this issue when etract and install .apk from .aab in google PlayStore. I will post another article to clear the issue under this scenario.

Reference

  1. Obtaining a Signing Certificate Fingerprint on the Wearable Device
  2. Generating a Signing Certificate Fingerprint
  3. Wear Engine FAQs

--

--