当前位置:网站首页>微信公众号授权登录后报redirect_uri参数错误的问题
微信公众号授权登录后报redirect_uri参数错误的问题
2022-07-28 17:31:00 【阿升】
在进行微信公众号二次开发的时候,需要通过授权码模式来进行微信授权。比如,在进行登录的时候,用户点击了登录按钮,然后弹出一个授权框,用户点击同意后,就可以获取用户的OpenId等信息了。这篇文章主要分享下配置过程和遇到的redirect_uri参数错误问题。
等配置过程完毕,并且后端服务的问题都解决后,就会看到下面的授权框: 
一.服务器配置
服务器配置主要是服务器地址(URL),令牌(Token),消息加解密密钥,消息加解密方式:
点击配置按钮后,根据实际情况填写如下:
如果参数配置正确,那么提交后会有提交成功的提示。另外还需要把服务器IP地址配置在公众号开发信息->IP白名单中: 
二.公众号相关域名
公众号相关域名包括网页授权域名,业务域名和JS接口安全域名。接下来主要讲解它们是为了解决什么问题,以及如何操作的。需要说明的是这3个域名的下载文件都是相同的,包括文件名和文件内容,因此只需要在域名根目录(即wwwroot目录)下上传一个就行了,然后就是分别配置域名。 
1.网页授权域名
网页授权域名主要是获取openid的时候使用。根据要求填写网页授权域名: 
2.业务域名
业务域名主要是防止输入框出现警告提醒的时候用。根据要求填写业务域名: 
3.JS接口安全域名
JS接口安全域名主要是使用jssdk的时候用。根据要求填写JS接口安全域名:
公众号相关域名配置成功后,会有提交成功的提示。配置完毕后,公众号设置->功能设置如下: 
三.Vue项目IIS部署后,刷新页面404问题
Vue项目IIS部署启动后,再次刷新页面会报404。解决方案主要是安装和配置URL重写模块,配置如下: 
微信公众号二次开发过程中还涉及其它的相关问题,当从https://demo.xxx.com/yyy/zzz跳转到https://demo.xxx.com:6666/aaa/bbb时,会遇到跨域的设置。还有一些其它的问题,比如,如何实现ABP和Senparc库集成,如何把微信账号和系统账号打通,微信公众号中消息和事件的处理等。在开发的过程中微信公众平台接口调试工具[4]还是很好用的: 
参考文献:
[1]redirect_uri参数错误的解决办法:https://blog.csdn.net/zl544434558/article/details/46785565
[2]解决微信OAuth2.0网页授权只能设置一个回调域名的问题:https://github.com/HADB/GetWeixinCode
[3]微信公众号网页授权:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html
[4]微信公众平台接口调试工具:https://mp.weixin.qq.com/debug
边栏推荐
- [image hiding] digital image information hiding system based on DCT, DWT, LHA, LSB, including various attacks and performance parameters, with matlab code
- 架构实战营第8模块作业
- IMU heating
- 力扣 1331. 数组序号转换
- [physical application] Wake induced dynamic simulation of underwater floating wind turbine wind field with matlab code
- [physical application] atmospheric absorption loss with matlab code
- Application of TSDB in civil aircraft industry
- 2022年中总结
- Learn from Li Mu in depth -softmax return
- [radar] radar signal online sorting based on kernel clustering with matlab code
猜你喜欢

Leetcode skimming - super power 372 medium

Web 3.0 development learning path

Libgdx learning road 02: draw game map with tiled

使用Xilinx MIG验证硬件DDR设计

Pyg builds heterogeneous graph attention network han to realize DBLP node prediction

当CNN遇见Transformer《CMT:Convolutional Neural Networks Meet Vision Transformers》

Photoshop web design practical tutorial

使用百度EasyDL实现明厨亮灶厨师帽识别
![[physical application] Wake induced dynamic simulation of underwater floating wind turbine wind field with matlab code](/img/31/e4cd4c261a7fc5cfa731976314530b.png)
[physical application] Wake induced dynamic simulation of underwater floating wind turbine wind field with matlab code

BLDC 6-step commutation simulink
随机推荐
Pytorch:快速求得NxN矩阵的主对角线(diagonal)元素与非对角线元素
UWB module realizes personnel precise positioning, ultra wideband pulse technology scheme, and real-time centimeter level positioning application
[radar] radar signal online sorting based on kernel clustering with matlab code
[filter tracking] target tracking based on EKF, TDOA and frequency difference positioning with matlab code
RFs self study notes (III): clutter model - first determine the number with Poisson distribution, and then use uniform distribution as probability distribution
How to use Qianqian listening sound effect plug-in (fierce Classic)
Avoidance Adjusted Climbrate
服务器正文21:不同编译器对预编译的处理(简单介绍msvc和gcc)
Doxygen document generation tool
VIM learning manual
BM16 删除有序链表中重复的元素-II
Time waits for no man. The rise of TSDB is at the right time
优麒麟系统安装BeyondComare
R语言与数据分析实战11-数据的删除
Jestson nano Object detection
Using CPLEX to solve small-scale energy-efficient FJSP
DevCon.exe 导出output至指定文件
Wechat solves the problem of long press selected style
CVPR21-无监督异常检测《CutPaste:Self-Supervised Learning for Anomaly Detection and Localization》
SaltStack进阶