微信网页授权的两种返回结果

微信公众号网页授权的两种方式,snsapi_base、snsapi_userinfo

snsapi_base基础信息静默授权,不会打扰到用户,授权返回内容是:

{
	"id": "og11w0hu...",
	"name": null,
	"nickname": null,
	"avatar": null,
	"email": null,
	"original": {
		"access_token": "27_T...",
		"expires_in": 7200,
		"refresh_token": "EQ...",
		"openid": "og1",
		"scope": "snsapi_base"
	},
	"token": "27_TDiwj62xKsng...",
	"provider": "WeChat"
}

snsapi_userinfo用户公开信息授权,第一次需要用户确认,授权返回内容是:

{
	"id": "og11w0hu...",
	"name": "Charles",
	"nickname": "Charles",
	"avatar": "http:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/PiajxSqBRaEJW4jPlAdDLJeG67fhnotIzBgL0tZjJBYnGLvG2TDPv0rAc0X7ZcZV03D4qsTicDPXTj7ibDkqbnYdw\/132",
	"email": null,
	"original": {
		"openid": "og1...",
		"nickname": "Charles",
		"sex": 1,
		"language": "zh_CN",
		"city": "扬州",
		"province": "江苏",
		"country": "中国",
		"headimgurl": "http:\/\/thirdwx.qlogo.cn\/mmopen\/vi_32\/PiajxSqBRaEJW4jPlAdDLJeG67fhnotIzBgL0tZjJBYnGLvG2TDPv0rAc0X7ZcZV03D4qsTicDPXTj7ibDkqbnYdw\/132",
		"privilege": []
	},
	"token": "27_CFj...",
	"provider": "WeChat"
}

本文json串使用bejson工具格式化