微信网页授权前后端分离的情况处理

由前端跳转授权页面并获取code如:

https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc3e85c6d52793d52&redirect_uri=http://xxxxxxxxxx/test&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect

 

获取code后再调用 后端接口,后台根据code可以获取用户的opendid和再根据opendi获取用户信息,这时候就可以和前端 的用户建立关联。