Loading…

User registration/login/forgot password/logout

# Knowledge point review This article mainly introduces how to quickly implement user registration with mobile phone number + SMS verification code in Flutter, and then use the mobile phone number to log in. So before reading this article, you need to review and understand the contents of the following chapters: ["Using apifm plug-in for Flutter cloud development - SMS verification code"](https://www.yuque.com/apifm/doc/vr26l6) #Backend configuration ## Open the developer backend for free ["Using apifm plug-in for Flutter cloud development - Installation"](https://www.yuque.com/apifm/doc/hggphs) ## Open the "Mobile phone number user registration and login" module 1. Log in to the "First Step" registration background, left menu --> Factory settings --> Module management 2. Find the "Mobile Number User Registration and Login" module, click "Enable Module", and then F5 to refresh the background interface # apifm usage instructions ## Mobile phone number registration ```javascript Apifm.register_mobile(Mapparams) ``` The most commonly used registration method is to enter your mobile phone number, get the SMS verification code, and complete the registration after passing the backfill verification. **Sample code:** ```javascript Apifm.register_mobile({ 'mobile': '13500000000', 'pwd': '123456', 'nick': '张三' }) ``` ## Mobile phone number login ```javascript Apifm.login_mobile(String mobile, String pwd, String deviceId, String deviceName) ``` **Sample code:** ```javascript var res = await Apifm.login_mobile('13500000000', '123456', '33010500879931234', 'iphone8 Plus'); int uid = res['data']['uid']; String token = res['data']['token']; print('uid: $uid, token is : $token'); ``` _deviceId It is recommended to read the mobile phone serial number; _ _deviceName is recommended to read the mobile phone model;_ ## Reset password after forgetting it ```javascript Apifm.resetPwd(String mobile, String pwd, String code) ``` Used to retrieve forgotten passwords and use them when resetting passwords Fill in your mobile phone number and the system will send you a SMS verification code. Fill in the correct verification code and complete the setting of the new password. ## Check whether the login token is valid ```javascript Apifm.checkToken(String token) ``` ## Log out ```javascript Apifm.loginout(String token) ``` After exiting, the current token will become invalid immediately. **Reading thousands of books is not as good as traveling thousands of miles! Write your own helloworld and put knowledge in your pocket! ** _Looking forward to you becoming my boss~_