【Business Touch Kit】服务号消息发送接口返回401如何解决?
source link: https://blog.51cto.com/u_14772288/5660112
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
【Business Touch Kit】服务号消息发送接口返回401如何解决?
精选 原创【Business Touch Kit 简介】
华为服务号(Business Touch Kit)提供给商家对应的服务号,让用户快速发现商家服务,建立用户与商家的互动连接。为您提供华为统一的商家服务号中心,通过服务分发,用户互动连接,多样化的营销工具等,促进商家的商业闭环。
【问题描述】
调用服务号消息发送的接口发起HTTP请求时,返回了401的状态码,如下所示:
请求头参数如下图所示:
请求体参数如下图所示:
【解决方案】
1、HTTP请求返回401的状态码,一般情况下都是未授权,身份认证不通过,需要检查access_token是否正确,关于该参数的说明,详细情况请查看如下链接中的说明文档:
2、这个参数是必传的,需要按照开放平台中的要求来获取,获取方式的说明文档如下链接中所示:
3、打开链接会看到,获取access_token的请求参数说明情况如下图:
4、其中,client_id和client_secret这两个参数的获取方式详情如下:
首先登录AppGallery Connect官网,如下所示:
https://developer.huawei.com/consumer/cn/service/josp/agc/marketplace/index.html#/
然后依次点击:控制台--->我的项目--->项目设置,找到对应的应用,如下图所示:
这里可以获取到Client ID和Client Secret这两个参数的值,再结合上面文档中的接口说明,请求该接口获取access_token。
按照以上步骤进行操作,就可以解决消息发送的接口返回401的错误啦!
欲了解更多更全技术文章,欢迎访问 https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh
- 赞
- 收藏
- 评论
- 分享
- 举报
Recommend
-
147
PHP - @cielpy - 一直以来有一个疑问,和后端同事合作时定好了接口文档,如:```{ type: 0}```定义好 type 是 number 类型,返回数据一会儿是 string,
-
60
-
11
php发送请求,解决curl返回空白问题如果您发现本文排版有问题,可以先点击下面的链接切换至老...
-
8
netty 服务端主动向客户端发送消息后, 怎么接收返回 ...
-
5
HTTP Cookies是服务器发送到用户浏览器并保存在本地的一小块数据,它会在浏览器下次向同一服务器再发起请求里被携带并发送到服务器上。 Cookie 主要用于以下三个方面: 会话状态管理(如用户登录状态、购物车、游戏分数或其它...
-
8
解决PHP在Linux下curl发送POST请求返回400的问题 代码部署到服务器后,curl发送POST请求,返回400状态码,经...
-
6
V2EX › Java 如何大量请求发送短信接口? Jekins · 1 天前 · 2026 次点击
-
3
Matrix 首页推荐 Matrix 是少数派的写作社区,我们主张分享真实的产品体验,有实用价值的经验与思考。我们会不定期挑选 Matrix 最优质的文章,展示来自用户的最真实的体验和观点。 ...
-
4
如何通过企业微信发送消息通知 蚊子前端博客 发布于 2023-02-10 14:52 企业微信为我们提供了多种消息通知的方式,每种方式都有哪些特点,怎么接入呢? 通过企业微信发送消息通知...
-
4
关于向nginx发送非 GET,POST,HEAD请头,返回 405 Not Allowed问题. 2023年 5月 一...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK