Skip to content

Latest commit

 

History

History

auth

Auth quickstart

English | 中文

Table of Contents

Introduction

Most apps need to identify and authenticate users to tailor the app experience for individual users. However, building such a system from scratch is a difficult process. Auth Service can quickly build a secure and reliable user authentication system for your app. You only need to access Auth Service capabilities in your app without caring about the facilities and implementation on the cloud.

Preparing the Environments

  • A computer with Weixin DevTools installed

Getting Started

Before running the auth quickstart, you need to:

  1. If you do not have a HUAWEI Developer account, you need to register an account and pass identity verification.
  2. Use your account to sign in to AppGallery Connect, create a project and add an app, set app platform to Web.
  3. Select your project and app in My projects, and go to Build > Auth Service to enable the Authentication service.
  4. Select Project Settings,and go to Manage APIs, enable the Auth Service.
  5. Go to General information, copy the SDK Code Snippet json from AppGallery Connect and paste the json to auth-weixin.ts in this demo.
  6. Select your project and app in My projects, and go to Build > Auth Service > Authentication mode, enable Mobile number, Email address, Anonymous account.
  7. Run the following code in terminal in the demo path, and run the demo.
    # install AGC auth sdk
    npm install @agconnect/[email protected] --save
  8. More details about Auth

Sample Code

Sample code: \pages\auth-weixin.ts

Result

loginAnonymous
anonymous

createUser
createUser

deleteUser
deleteUser

loginByPin
loginByPin

loginbyPWD
loginbyPWD

Question or issues

If you have questions about how to use AppGallery Connect Demos, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with AppGallery.
  • Huawei Developer Forum AppGallery Module is great for general questions, or seeking recommendations and opinions.

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

License

auth quickstart is licensed under the Apache License, version 2.0.