我有一个 网络应用程序 向手机浏览器发送推送通知的项目。我已成功从我的 中检索到推送 token 华为设备但无法从我的服务器通过 HMS Push Kit 发送通知,得到一个 HTTP 401 并且错误正文包含:
{
"msg": "No permission to send message to these tmIDs",
"code": 80300002
}
我已经联系了客户服务并被指向以下 URL,我做了那里列出的所有内容,但仍然出现相同的错误。这是返回错误的 URL (POST)(从我的服务器发送,使用项目设置中的应用程序 ID):
https://push-api.cloud.huawei.com/v1/my_app_id_from_project_settings/topic:subscribe
访问 token 是使用来自控制台的 OAuth 2.0 客户端 ID/ secret (“凭据”)从以下 URL 检索的:
我还从控制台申请了华为帐号(应用服务 > 开发 > 华为帐号,使用相同的 OAuth 2.0 Client ID/secret)。
我为故障排除做了什么:
topic
(字符串)和 tokenArray
(字符串数组,例如 ["token1", "token2"]
)Authorization: Bearer <access_token>
的 POST 请求 header Content-Type: application/json
的 POST 请求 header 最佳答案
请在web应用项目下创建Android应用,获取 access_token 使用 Android 应用程序的 appid 和 appsecret。然后是 access_token 可以传入send接口(interface)。
关于huawei-mobile-services - 无法发送通知 [错误 : 80300002] (HMS Core Push Kit) - Web App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65504542/