Common Issues While Using Health Kit

Erman Derici
Huawei Developers
Published in
4 min readJan 29, 2024
Health Kit

Introduction

Hello everyone, if you have experienced issues or encountered problems while integrating HMS Health Kit to your app, then there’s a high chance that your solution is in this article. In this article, we will go over the most common Health Kit issues and solutions to solve them.

Invalid Credentials

This response means there is an error with your access token. You can try these steps to solve this issue:

  • Make sure your token is not expired.
  • Make sure you have followed the correct steps required for OAuth 2.0 authorization.
  • Confirm that your client secret, client_id and other values are set to the correct project’s values.

403: Insufficient Permission: Request had insufficient authentication scopes

One of the most common problems with Health Kit. This is caused by your authentication token & access token not having the required permission for your request.

When you are asking for user permissions, you need to include necessary scopes in your link:

Authentication & authorization steps

The problem here is that you are able to include as many data scopes as you can in this link. Doing so will result in this error if you are making a request for a data scope you have not included when you were applying for Health Kit. You only need to include your approved data scopes.

400 Bad Request invalidArgument

This error is caused by your request including unsupported parameters. Double check your parameters and make sure they are the correct types. You can look at the documentation to see what types are supported for your request.

Parameters Example

Empty data returned even when there is data visible in Huawei Health App

There could be multiple causes for this issue. The most common way to fix this is to manually sync your data with Huawei Cloud and trying again. Me > Settings > Sync data manually in Huawei Health and click the SYNC button.

Otherwise, make sure your Health App has authorized to share data with Health Kit. Open the Huawei Health app, go to Me > Privacy management, and toggle on HUAWEI Health Kit.

If the issue still persists, please double check your request parameters and make sure your parameters are of the correct types. Some parameter types are in nanoseconds type, if you provide a milliseconds type there won’t be an error, but you won’t get any data in the response.

403 error code 121001 request forbidden due to site cross.

This is caused by cross-domain requests. For example, a user in Europe will encounter this error when trying to access data from Chinese mainland.

The simplest solution for this is to use the Location field in the response header:

Location field in the response headers

No default dataCollector found for: *****

This is caused by using an incompatible data type for your request. Make sure your request supports the data type you wish to use.

You can check the supported requests for a data type in our documentation:

Supported requests for a data type.

Using any other requests than the ones written here will potentially result in an error.

Conclusion

In this article, we have explored the most common problems encountered when using Health Kit and seen solutions for these problems. If your problem was not fixed by the solutions provided or you have a different issue, you can always a submit a ticket. We’re more than happy to help you. You can use this link to submit a ticket.

--

--