Loading…

PC website implements WeChat login

#Create website application Log in [https://open.weixin.qq.com/](https://open.weixin.qq.com/) Create a website application: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1594454544672-1bf527a5-ebbd-4988-83c0-1f7b7ccfeb7e.png) After creating a website application, it can be used after it is approved; You may need to pass WeChat authentication. Only after passing WeChat authentication can you obtain the "interface permission" of the website application, otherwise you will not be able to use the interface function. # Configure system parameters After the website application in the previous step is created, you will obtain the appID and secret information of the application. Now configure this information into your background system parameters: Go to the menu "System Settings" --> "System Parameters" --> "Add Text Parameters" Fill in your appID for the parameter name Fill in the parameter value with your secret Please select** for parameter statusConfidentiality Be sure to choose confidentiality! ! !** # Place WeChat login button On the web page where you need to log in, add a button or link to jump to the authorization page. Please check the official jump instructions for the link address: [https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html](https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html) Check out the "Step 1: Request code" section of this document. # Call the interface to implement one-click registration and login At this point, you have obtained the code parameter of the snack voucher for login. Now it’s time to call the one-click registration and login interface of “apifm” to achieve one-click authorization. [##/%E5%89%8D%E7%AB%AFapi%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3/%E5%BE%AE%E4%BF%A1%E5%BC%80%E5%8F%91/authorizationUsingPOST] (##/%E5%89%8D%E7%AB%AFapi%E6%8E%A5%E5%8F%A3%E6%96%87%E6%A1%A3/%E5%BE%AE%E4%BF%A1%E5%BC%80%E5%8F%91/authorizationUsingPOST) ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1594454923290-d31be32d-ef48-400f-921f-fac39b79a585.png) After the interface is called successfully, a token indicating successful authorization will be returned to you. Please save it yourself and you're done!