{"errcode":48001,"errmsg":"api unauthorized}
微信公众号基础知识说明
网页授权获取微信用户信息:两种 scope 域
https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri={1}&response_type=code&scope={2}&state=ok#wechat_redirect
snsapi_base:静默授权,直接跳转到授权后的页面,只能用于获取openid
snsapi_userinfo:必须用户同意授权后,可以获取用户基本信息
案例说明
公司有两个公众号分别是公众号1,公众号2,有个业务场景,需要用户在关注公众号1中,输入指定商品积分码后,会给另外一个公众号2发一个现金红包,这里就要在公众号1页面通过snsapi_base方式获取用户在公众号2的网页授权code,调用微信开放api换成openId,这时,用户很可能未关注公众号2(如果用户未关注公众号2,必须采用snsapi_userinfo方式才能获取到用户基本信息),本人就掉进这个坑,在调用获取token后,又调用了获取用户信息,从而导致报错{"errcode":48001,"errmsg":"api unauthorized}。
错误原因分析
由于调用微信第三方插件,对微信公众号基础api了解不深入,其实获取token接口的返回结果就有openId,格式如下:
{
"access_token":"112123123123",
"expires_in":7200,
"refresh_token":"12312312312",
"openid":"oYbGRs8MmU6bESxXcX2Z0rFRivjQ",
"scope":"snsapi_base"
}
希望大家看了我的文档,不要和我掉进相同的坑里。
---------------------
作者:柯之梦
来源:CSDN
原文:https://blog.csdn.net/yin4302008/article/details/85256438
版权声明:本文为博主原创文章,转载请附上博文链接!
{"errcode":48001,"errmsg":"api unauthorized}的更多相关文章
- Solve Error: "errcode": 48001, "errmsg": "api unauthorized hint"
当你想给微信公众号(不是测试账号)自定义菜单创建接口,遇到如下错误: OK Connection: keep-alive Date: Sat, 01 Dec 2018 05:02:08 GMT Con ...
- 微信 {"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}
{"errcode":,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]&q ...
- 调用 微信接口报错 {"errcode":48001,"errmsg":"api unauthorized, hints: [ req_id: 1QoCla0699ns81 ]"}
如下截图,仅为备份,本文转载地址: http://www.cnblogs.com/liaolongjun/p/6080240.html 以下正文↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ ...
- Java微信开发_Exception_03_errcode:48001 errmsg:api unauthorized hint
创建菜单时出现这个异常, 异常信息:errcode:48001 errmsg:api unauthorized hint 解读:调用的接口没有权限. 回去公众号后台一看,发现真的没有自定义菜单的权限, ...
- 微信公共账号开发:48001 api unauthorized解决
微信公众平台开发:获取token成功并且拉取自定义菜单也OK,但是在拉取用户信息和分组信息 是总是出现这个 {"errcode":48001,"errmsg": ...
- 微信第三方平台代公众号发起网页授权 48001 api unauthorized 问题
https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&gr ...
- {"errcode":40097,"errmsg":"invalid args hint: [vjNe7xxxxxx8vr19]"}——记录一次微信错误处理
错误情况概述: 启动应用之后,微信调用 相机拍照 等接口是可以正常使用的, 但是过了一段时间(2个小时左右--token/jsapi_ticket的过期时间),微信调用相机拍照的功能失效,启用debu ...
- 上传图文{"errcode":40007,"errmsg":"invalid media_id"}解决方案
{"errcode":40007,"errmsg":"invalid media_id"}解决方案 网上关于这个问题的解决一般是把thumb ...
- 小程序获取openid 出现null,{"errcode":40163,"errmsg":"code been used, hints: [ req_id: WNUzlA0105th41 ]"}
//根据微信提供的接口,请求得到openid和session_id public class UserInfoUtils { private String getKeyURL="https: ...
随机推荐
- 随机森林(Random Forest),决策树,bagging, boosting(Adaptive Boosting,GBDT)
http://www.cnblogs.com/maybe2030/p/4585705.html 阅读目录 1 什么是随机森林? 2 随机森林的特点 3 随机森林的相关基础知识 4 随机森林的生成 5 ...
- shell 基本概述
SHELL的概念 SHELL是一个命令行解释器,它为用户提供了一个向Linux内核发送请求以便运行程序的界面系统级程序, 用户可以用shell来启动,挂起,停止甚至是编写一些程序. Shell还是 ...
- spoj220
题解: 后缀数组 把所有串连接起来 二分答案 代码: #include<cstdio> #include<cstring> #include<algorithm> ...
- markdown语法模板
(GitHub-Flavored) Markdown Editor Basic useful feature list: Ctrl+S / Cmd+S to save the file Ctrl+Sh ...
- 【转载】Maven中的BOM概念
1.概述 1.1.什么是 BOM? BOM stands for Bill Of Materials. A BOM is a special kind of POM that is used to c ...
- ORM版学员管理系统1
ORM版学员管理系统 班级表 表结构 class Class(models.Model): id = models.AutoField(primary_key=True) # 主键 cname = m ...
- 第三篇 功能实现(2) (Android学习笔记)
第三篇 功能实现(2) ●Activity的四种启动模式 Activity的启动模式有四种,分别是standard.singleTop.singleTask和singleInstance. 在Andr ...
- winserver 搭建 Citrix License 许可服务器
1. 申请许可证 Citrix XenApp_XenDesktop7.6和XenServer 6.5申请许可证的步骤是一致的,由于之前我已经申请过XenApp_XenDesktop的许可证,本次以X ...
- 关于jvm钩子 Runtime.getRuntime().addShutdownHook
转自: http://www.cnblogs.com/nexiyi/p/java_add_ShutdownHook.html 在线上Java程序中经常遇到进程程挂掉,一些状态没有正确的保存下来,这时候 ...
- POJ - 1942 D - Paths on a Grid
Imagine you are attending your math lesson at school. Once again, you are bored because your teacher ...