The HMS Core push service allows developers to access the Push server using the HTTPS protocol, and can send downlink messages from the server to terminal devices. This article summarizes the 6 most common error codes for messages sent by the server, and provides cause analysis and solutions. Developers who have encountered similar problems should take a look.

Error code one: 80200001, "Oauth authentication error"

Cause Analysis:

  1. The Authorization request parameter is not added to the delivered message or the value is empty.

  1. This error code also occurs when the Access Token applied for by application A's APPID is used to push messages to application B.

Apply for Access Token

send a message

Solution:

  1. Check whether there is an input Authorization request parameter in the request HTTP header. For the authorization method, please refer to the document , and the downlink message API can refer to the document .
  2. The APPID used to obtain the Access Token and the APPID used to deliver the message must be consistent.

Error code 2: 80300007, "Token invalid error"

Cause Analysis:

  1. The token is illegal, there are more or less characters in the token, for example, there is an extra space in the figure below.

  2. This situation is also one of the reasons for sending a message to application A, but the token belongs to application B.

Solution:

  1. Check whether the token parameter is correct;
  2. Make sure that the token used to send the message is obtained from the target application

Error code 3: 80300010, "The number of tokens in the message body does not meet the default value"

Cause Analysis:

  1. The developer misspelled the "message" field, and the message field in the example picture ended with an 'r';
  2. The token position is incorrect, and the field structure is problematic;
  3. The number of issued tokens exceeds the limit, or the token is empty.

Solution:

  1. Make sure that the message and token fields are written correctly;
  2. The message field contains the token, the same level as "android";

  1. The number of tokens should be between 1 and 1000. Confirm the number of token parameters. Please refer to the documentation for the field structure and description.

Error code four: 80200003, "Oauth Token expired"

Cause Analysis:

  1. The Access Token in the Authorization request parameter value has expired
  2. Incorrect request parameter value, more or less other characters.

Solution:

  1. The Access Token is valid for one hour. If it exceeds the time limit, you need to re-acquire and use the latest Access Token to send messages. Refer to the documentation for the method of re-obtaining the Access Token
  2. Make sure that the used Access Token is the same as the obtained one. If escape characters appear when copying the Access Token, you need to restore "/" to "/".

Error code five: 80100016, "The message contains sensitive information"

Cause Analysis:

This error message indicates that the content of the push message contains sensitive information

Solution:

  1. Since no sensitive thesaurus is provided, developers need to detect the content by themselves;
  2. Developers can access PushBian, and Huawei will not conduct a second review after the message is approved by PushBan. The process of accessing TubiAn can be found in [Reference Document]().

Precautions:

  1. After the approval of Tuibian, the result returned by Tuibian needs to be added to the result object of the Huawei Review field, so that Huawei can know that the message has passed the review when the message is sent, and Huawei will not conduct a second review.
 "review": [
        {
            "reviewer": "tuibian",[]()
            "type": 0,
            "result": {

                //以下为推必安返回结果
                "code": 200,
                "data": {
                    "auditEngine": "t****ine",
                    "auditId": "0f74b*******0b3f490d",
                    "labels": []
                },
                "msg": "Pass",
                "sign": "MEQCIBHc********IqLjw=="

            }
        }
    ]
}
  1. Instead of putting the entire message body in the "content" field of PushBan, it is the content in the "message" that needs to be reviewed. At the same time, the content of the message body is sorted in ascending ASCII code and then converted into a string format for review.
 {
    "validate_only":false,
    "message":{

        //以下部分需要审核
        "notification":{
            "title":"message title",
            "body":"message body"
        },
        "android":{
            "collapse_key":0,
            "notification":{
                "click_action":{
                    "type":2,
                    "url":"https://example.com"
                }
            }
        },

        "token":[
            "pushtoken1"
        ]
    }
}
  1. Due to the cumbersome review process, it is recommended to reduce the use of the delivery fields. This will make the operation easier and avoid the 80100018 error code when sending messages. This error code means that the message body sent to the three-party agency for review is inconsistent with the message body when it was sent.

Error code 6: sub_error":57303,"error_description":"appid is overload blocked","error":1302

Cause Analysis:

Too many requests for access_token are flow-controlled, and the flow-control threshold is 1000 per 5 minutes.

Solution:

Adjust the request logic, the access_token is valid for one hour, and there is no need to apply frequently. The flow control resets after 5 minutes and can be applied again. For more access_token related restrictions, please refer to the documentation .

Learn more details>>

Visit the official website of Huawei Developer Alliance
Get development guidance documents
Huawei Mobile Services Open Source Warehouse Address: GitHub , Gitee

Follow us to know the latest technical information of HMS Core for the first time~


HarmonyOS_SDK
596 声望11.7k 粉丝

HarmonyOS SDK通过将HarmonyOS系统级能力对外开放,支撑开发者高效打造更纯净、更智能、更精致、更易用的鸿蒙原生应用,和开发者共同成长。