【问题标题】:How to use the device token to send downlink message如何使用设备令牌发送下行消息
【发布时间】:2021-11-03 06:50:09
【问题描述】:

查看官方文档,device_token不能用于hms_server发送下行消息。如果我想访问 hms_server,我必须请求另一个 oauth2 令牌。是否意味着device_token和hms_server_token都应该一直更新,还是只选择device_token这样的一个来发送下行消息?

URL: https://push-api.cloud.huawei.com/v1/appid/messages:send

Request Header: 
Authorization Bear token (need to request from hms_server, the device_token is only used for identify the address of device)

【问题讨论】:

标签: android push-notification huawei-mobile-services huawei-push-notification


【解决方案1】:

device_tokenaccess_token 都是必需的。 device_token 由客户端获取并在令牌更改时更新。更改场景请参考Docs

access_token 有一个有效期。获取到access_token后,返回有效期。一般有效期为一小时。 access_token在有效期内使用,不需要每次更新。

【讨论】:

  • 如果access_token过期了,是否可以自动使用之前的token生成新的token并发送推送消息?
  • 不,你不能。如果access_token过期了,需要使用API​​重新获取。
猜你喜欢
  • 1970-01-01
  • 2018-05-15
  • 2020-06-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-09-22
  • 1970-01-01
相关资源
最近更新 更多