python - 微信登录授权

 wjr_l_be78e4 发布于 2022-10-31 07:50


手机端微信打开就是这样

以下是控制台的信息,我打印了请求url

Starting development server at http://127.0.0.1:80/
Quit the server with CTRL-BREAK.
https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx478762de33427c1d&redirect_uri=http://zhang.tunnel.qydev.com/oauth/&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
[02/May/2016 20:48:15] "GET /oauth/ HTTP/1.1" 302 0


我用ngrok转发的,微信signature验证是没问题的
请问这里哪里出了问题,请求指点

下面是后台函数    

def get_connect_url(self,
                redirect_url,
                scope="snsapi_userinfo",
                state="STATE"):
redirect_url = urllib.parse.quote("http://zhang.tunnel.qydev.com/oauth")
return CONNECT_URL%(self.app_id, redirect_url, scope, state)
2 个回答
  • GET参数需要parse.urlencode吧?

    2022-11-12 01:49 回答
  • 不能在localhost调试。另外可以查看参数的顺序。这个是有要求的。

    2022-11-12 01:49 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有