I have always been curious about this function, and I finally got it working yesterday. Record it here. WeChat official introduction
Before performing WeChat OAuth2. Before performing WeChat OAuth2.0 authorized login access, register a developer account on the WeChat open platform, and have a alreadyAudit passed website application, and obtain the corresponding AppID and AppSecret , after applying for WeChat login and passing the review, you can start the access process
The official document has stated that the developer account review fee is ¥300. , the website application can be created in the management center of the open platform, and the review is very fast. After the review is passed, the AppID and AppSecret are obtained. The AppId of the public account has not been able to obtain the QR code. Prompt scope or no permission.
Also, don’t write the wrong domain name. If you change it, you will have to wait at least the next day.
https://
open.weixin.qq.com/connect/qrconnect?appid=wxd96be4258f671daa&redirect_uri=http://www.warmwood.com/WeiXinAuth&response_type=code&scope=snsapi_login&state=3d6be0a4035d839573b04816624a415e#wechat_redirect After the parameters are correct, you can get the correct QR code. The next step is to obtain the user information and log in
I was dumbfounded at this time, how to
debugThe information obtained does not have an email address and password. It is necessary to create a page for the user to set an email address and a new password.Login with the public account
Login within WeChat and scan the QR code on the website cannot be done. Same. Scope uses userinfo. Website code scanning requires creating a website application in the development platform. The openid obtained by the two is different, but the paid appid must match the merchant's ID, otherwise the payment cannot be made.code = Request.QueryString[ state = Request.QueryString[ (code != Logger.Info( + + url = result = <OAuthAccessTokenResult>(, url, = user =); }
<a title="微信登录" class="logwx" id="zhilogon" href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxd6bc2f224b5ffbac&redirect_uri=http://www.xxx.com/weixinAuth&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"> <img src="/images/logwx.png" /> </a>
The login interfaces of the official account and web application are as follows
The interface is slightly different.
The above is the detailed content of Some new features of WeChat login. For more information, please follow other related articles on the PHP Chinese website!