How Can I Quickly Integrate AppGallery Connect Auth Service into a Web App?

Currently, AppGallery Connect Auth Service also supports web apps. I have integrated the service by referring to the official documentation. You can also download the sample code for reference. I’ll show you the simple procedure in this post.

Integration Procedure

a) Create a web app in AppGallery Connect.

b) Enable Auth Service.

c) Enable the Anonymous account, Mobile number, and Email address authentication modes.

2. Integrating the AppGallery Connect SDK

a) Add the configuration code to the login.vue file.

b) In Huawei Quick App IDE, open your quick app project, integrate the AppGallery Connect JavaScript SDK to your project, and import the module for Auth Service.

3. Implementing Functions

a) For anonymous accounts:

Add a button for anonymous sign-in to your test app and click the button. The sample code is as follows:

When the anonymous sign-in is successful, a UID is displayed.

b) For mobile phone numbers or email addresses (password mode):

Add a text box for users to input the mobile phone number or email address and a text box for the password input to your test app. Input required information to sign in to the app. The sample code is as follows:

c) For mobile phone numbers or email addresses (verification code mode):

Add a text box for users to input the mobile phone number or email address and a button for obtaining a verification code to your test app. Input required information and click the button to obtain the verification code. The sample code is as follows:

Add a button for sign-in using a verification code. The sample code is as follows:

Summary

AppGallery Connect Auth Service provides quite a lot of authentication modes and the integration is simple to complete.

If you have any other questions, please check the official demo.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store