Home  >  Article  >  WeChat Applet  >  Some new features of WeChat login

Some new features of WeChat login

大家讲道理
大家讲道理Original
2017-04-11 14:24:212338browse

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

Get the QR code

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

debug

Well, the QR code only recognizes the domain name set in the website application, and your localhost cannot be used. Do you need to log on the server? This process is a bit confusing. I saw it posted on WeChat. A web developer tool. I don’t know how to debug it locally, and I don’t see the setting. Because there is not much code, I used the Senparc

framework## first. #。 Find the user and then Sign In. But if a user logs in with multiple third parties, it is necessary to determine that these accounts are the same person, so as not to create multiple users.

The 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 =);
         }

If you do not use the appid of the official account, you can also log in with one click using the appid of the created website application. The difference is Which appid is bound to your merchant account determines whether this openid can be used for payment within the official account.

  <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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn