0

微信网页二维码三方登录流程是怎样的?

genevieve created at6 years ago view count: 2384
report
回复
0

准备工作

去https://open.weixin.qq.com/开发平台申请个网页应用。

开发

第一步获取二维码网页。文档见 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=facc281a128c59be7293e69fd4345baeab3f2d49&lang=zh_CN

$redirectUri=urlencode('http://www.app.local/auth/wechat/callback');
$appId='';
$scope="snsapi_login";
$url = "https://open.weixin.qq.com/connect/qrconnect?appid=" . $appId."&redirect_uri=".$redirectUri
."&response_type=code&scope=".$scope."&state=233#wechat_redirect";
$result = file_get_contents($url);
$result = str_replace("/connect/qrcode/", "https://open.weixin.qq.com/connect/qrcode/", $result);

第二步, 扫描了以后回调, 拿access_token, refresh_token 再去获取用户信息处理即可。文档 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316518&token=facc281a128c59be7293e69fd4345baeab3f2d49&lang=zh_CN

6 years ago 回复

Recent search keywords