微信网页授权如何传递多个参数?redirect_uri如何包含参数

发布于 7 年前作者 xiulanduan10959 次浏览最后编辑 7 年前来自 ask

微信网页授权访问以下连接时

https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect 

请问:

1、state参数的长度有限,而且内容只能是字母和数字。请问如果我要增加其他的参数怎么办?

2、redirect_uri如果为http://www.baidu.com?a=123&b=678.后面的response\_type、scope、state等参数是否会被认为是redirect_uri的参数,导致该授权连接无效?


3、当访问授权连接成功后会跳转到 redirect_uri/?code=CODE&state=STATE,如果redirect_uri为http://www.baidu.com?a=123&b=678,则 redirect_uri/?code=CODE&state=STATE将变为http://www.baidu.com?a=123&b=678/?code=CODE&state=STATE,这里出现了两个“”并且b=678/?code=CODE如何解决?

1 回复
machao
machao1 楼5 年前

个人建议,先获取code,获取code之后跳转到另一个页面,这个页面获取code,然后通过code获取用户信息。获取用户信息之后,再携带参数跳转,通过参数请求数据并渲染