New ability丨report, email login is supported!

New ability丨report, email login is supported!

Preface

Mini Program, Web, Mobile...No matter where the application comes from, it is inseparable from the step of user login authentication if it wants to operate normally. As the leading cloud-native integrated application development platform in China, Cloud Development provides rich BaaS capabilities and client support for developers of small programs, Web and mobile applications. In terms of login authentication, Cloud Development has also supported WeChat official accounts. There are multiple login methods such as login, WeChat open platform login, anonymous login and custom login. Now you have two more choices!

This week, cloud development added two user login authentication capabilities- not logged in and email login . So far, cloud development has supported seven login methods including WeChat official account, WeChat open platform, anonymous login, no login, email login, SMS login, and custom login.

The following will focus on these two new login authentication capabilities.

Not logged in

For H5 and web applications, it cannot naturally obtain the user identity when logging in like the applet environment. Therefore, in actual applications, it is limited by the browser environment and cannot complete user identity authentication.

In the past, developers could use the anonymous login of cloud development to complete related operations. Now, in addition to using anonymous login, they can also choose to use not logged in to complete related tasks.

The not-logged-in feature allows developers to access the application without logging in after allowing the developer to not log-in. Developers can cooperate with security rules to restrict the access rights of unlogged users to resources. Compared with anonymous login, the unlogged state is more pure. It reduces the useless anonymous users to reduce the burden on the system by restricting unlogged users to carry out corresponding personalized planning and creation of private data.

In specific use, after configuring the non-login and corresponding data security rules, you can directly call cloud development resources after the environment is initialized.

import tcb from'tcb-js-sdk';const app = tcb.init({ env:'xxxx-yyy';});app.callFunction({ name:"test", data:{ info:'abc'} })

Email Login

For the majority of web applications, in addition to using WeChat scan code to quickly log in, the most frequently used also includes mailbox password login. Now, cloud development also provides the ability to log in by email. Developers can allow users to register and log in to CloudBase using their own email and password, and can also update the email and password used for login. With the help of mailbox login, developers can quickly access and realize the ability of mailbox login in their own web applications.

In specific use, after the mailbox login is configured, the API can be called to complete the user login and registration related capabilities after the environment is initialized. After successful login, you can call functions and database resources.

import tcb from "tcb-js-sdk";const app = tcb.init({ env: "your-env-id"});//Register account app .auth() .signUpWithEmailAndPassword(email, password) .then( () => {//Send verification email successfully});//Login account app .auth() .signInWithEmailAndPassword(email, password) .then((loginState) => {//Successful login});

summary

User login is the first department threshold for most applications. Whether it is not logged in or email login, cloud development is constantly listening and understanding user needs and helping users develop good applications. Finally, in addition to the seven login methods mentioned earlier, which login methods do you expect cloud development to support? Let us know in the comments section below!

Reference: https://cloud.tencent.com/developer/article/1662492 New ability丨 report, email login is supported! -Cloud + Community-Tencent Cloud