Integrate the one-click authorization (registration) login function of mobile WeChat into your App to achieve quick registration and quick login functions
Following the instructions in this tutorial, it is estimated that it will help you implement and master WeChat login in 5 minutes.

# WeChat open platform creation application
[https://open.weixin.qq.com](https://open.weixin.qq.com)
Go to the WeChat open platform and create a mobile application access. After passing the review, you can obtain an appid and secret;
All the appids and secrets mentioned below refer to this, not the official account, not the service account, and not the mini program, so be careful! !
# Developer background configuration appid and secret
["Using apifm plug-in for Flutter cloud development - Installation"](https://www.yuque.com/apifm/doc/hggphs)
**Open the "System Parameter Settings" module**
1. Log in to the "First Step" registration background, left menu --> Factory settings --> Module management
2. Find the "System Parameter Settings" module, click "Enable Module", then F5 to refresh the background interface
**Add system parameters**
1. Add the text parameter wx_sns_appid, fill in the parameter value with your appid, and the parameter status bit is a public parameter. The appid during initialization in flutter can read the value by reading the system setting method;
2. Add the text parameter wx_sns_secret and fill in your secret as the parameter value. The parameter status must be set to **Secret Parameter** to prevent the data from being leaked;
#Install Flutter dependencies
## pubspec.yaml file adds dependencies
```plain
dependencies:
fluwx: ^1.0.6
```
## Install dependencies
```bash
$ flutter pub get
```
##Introduce package
In the dart file, introduce the plug-in, which will be used below
```javascript
import 'package:fluwx/fluwx.dart' as fluwx;
```
# Call WeChat authorization
```javascript
const appid = 'wx4f32d9265f9cf669'; // This is the appid of the application created above
await fluwx.register(appId: appid); // Initialization
fluwx.sendAuth(scope: "snsapi_userinfo", state: "login"); // Call out the WeChat authorization interface
fluwx.responseFromAuth.listen((data) { //Callback after user operation
data.state // The state passed above, return to the original path
data.errCode // ERR_OK = 0 (user agrees) ERR_AUTH_DENIED = -4 (user refuses authorization) ERR_USER_CANCEL = -2 (user cancels)
data.code // Temporary login credentials obtained after user authorization
});
```
#apifm method
### WeChat one-click registration
```javascript
Apifm.registerWX(Mapparams)
```
**WeChat’s one-click registration function requires the following parameters:**
_Parameters returned after authorization:_
code
_Optional parameters:_
referrer Inviter, the user ID that invited you to register
postJsonString registered extended information, Json data format
## WeChat one-click login
```javascript
Apifm.loginWX(String code)
```
code is the temporary credential returned after successful authorization
## Bind WeChat one-click login
```javascript
Apifm.bindWXOpenid(token, code)
```
Users who have registered through mobile phone number, user name, etc. can bind WeChat through this method, and will be able to use WeChat to log in with one click in the future.
code is the temporary credential returned after user authorization
**Flutter source code for this example:**
[https://github.com/gooking/apifm-flutter-demo](https://github.com/gooking/apifm-flutter-demo)