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)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…