English | 中文
Auth Service integrates a client SDK and accesses our cloud service to build a secure and reliable user authentication system for your app. Auth Service supports multiple authentication modes and is closely integrated with other serverless services, effectively protecting user data by defining simple rules.
- A computer with Android Studio installed for app development
- A device or an emulator in Android Studio running Android 4.2 or a later version
- Check whether you have a HUAWEI ID. If not, register one and pass identity verification.
- Use your account to sign in to AppGallery Connect, create an app, and set Package type to APK (Android app).
- Enable authentication modes. 3.1 Sign in to AppGallery Connect, click My projects, and click a project that you want to enable Auth Service from the project list. 3.2 Go to Build > Auth Service. If it is the first time that you use Auth Service, click Enable now in the upper right corner. 3.3 Click Enable for each authentication mode you want to enable. 3.4 Configure information required by each authentication mode by referring to the development guide.
- Download the agconnect-services.json file from AppGallery Connect and copy this file to the app's module directory (for example, auth/app/) Before compiling the APK, make sure that the project includes the agconnect-services.json file; otherwise, a compilation error will occur.
The quickstart app supports the following authentication modes:
-
Anonymous account Sample code: src\main\java\com\huawei\agc\quickstart\auth\AnonymousActivity.java
-
Email address Sample code: src\main\java\com\huawei\agc\quickstart\auth\EmailActivity.java
-
Huawei Game account Sample code: src\main\java\com\huawei\agc\quickstart\auth\HWGameActivity.java
-
HUAWEI ID Sample code: src\main\java\com\huawei\agc\quickstart\auth\HWIDActivity.java
-
QQ account Sample code: src\main\java\com\huawei\agc\quickstart\auth\QQActivity.java If you need to integrate QQ account sign-in, integrate the QQ account access SDK first.
-
Account from your own system Sample code: src\main\java\com\huawei\agc\quickstart\auth\SelfBuildActivity.java
-
Weibo account Sample code: src\main\java\com\huawei\agc\quickstart\auth\WeiboActivity.java
-
WeChat account Sample code: src\main\java\com\huawei\agc\quickstart\auth\WeixinActivity.java
-
Facebook account Sample code: src\main\java\com\huawei\agc\quickstart\auth\FacebookActivity.java
-
Google account Sample code: src\main\java\com\huawei\agc\quickstart\auth\GoogleActivity.java
-
Google Play Games account Sample code: src\main\java\com\huawei\agc\quickstart\auth\PlayGameActivity.java
-
Twitter account Sample code: src\main\java\com\huawei\agc\quickstart\auth\TwitterActivity.java
-
Mobile number Sample code: src\main\java\com\huawei\agc\quickstart\auth\PhoneActivity.java
Sign in using an anonymous account
Update a user's profile picture
If you have any questions about the sample code, try the following:
- Visit Stack Overflow, submit your questions, and tag them with
appgallery
. Huawei experts will answer your questions. - Go to AppGallery in the HUAWEI Developer Forum and communicate with other developers.
If you encounter any issues when using the sample code, submit your issues or submit a pull request.
The sample code is licensed under the Apache License, version 2.0.