Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

huawei mobile services - Can't send notification [error: 80300002] (HMS Core Push Kit) - Web App

I have a web app project that sends out push notifications to phone browsers. I have successfully retrieved push token from my Huawei device but couldn't send notification through HMS Push Kit from my server, got an HTTP 401 and the error body contained:

{ 
  "msg": "No permission to send message to these tmIDs", 
  "code": 80300002
}

I've contacted the customer service and was pointed to the following URL, I did everything listed there but still get the same error.

https://developer.huawei.com/consumer/jp/doc/development/HMSCore-Guides-V5/commonerror-0000001059816656-V5

This is the URL (POST) that returned the error (sent from my server, using app ID from project settings):

https://push-api.cloud.huawei.com/v1/my_app_id_from_project_settings/topic:subscribe

Access token was retrieved from the following URL using OAuth 2.0 Client ID/Secret from the console ("Credentials"):

https://oauth-login.cloud.huawei.com/oauth2/v3/token

I've also applied for HUAWEI ID from the console (App Services > Development > HUAWEI ID, using the same OAuth 2.0 Client ID/secret).

What I did for troubleshoot:

  • Push Kit Enabled (both Console level and Project level)
  • Access token with backslash () removed and URL-encoded
  • Server Location: Singapore (Push Kit disabled and re-enabled as advised)
  • POST request body with a JSON body with only 2 properties topic (string) and tokenArray (string array, e.g. ["token1", "token2"])
  • POST request headers with Authorization: Bearer <access_token>
  • POST request headers with Content-Type: application/json
  • Debug using "Cloud Debugging" feature.
  • Tested on emulator running Android 11 (API-level 30, HMS Core 5.0.3.304)
  • Tested on my Huawei device running EMUI 8.0 (with Google Play Services)
  • Tested on Android Chrome 87 (device), Android Chrome 83 (emulator)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Please create an Android application under the project of the web application, and obtain the access_token with the appid and appsecret of the Android app. Then the access_token can be passed into the send interface.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...