We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
SamplesAccount KitClient Sample Code

Client Sample Code

Android Studio

If you are using Android Studio, you can choose to use the Java or Kotlin sample code as you need to implement the functions of signing in with a HUAWEI ID in authorization code or ID token mode and signing out of a HUAWEI ID.

Expand

Sample Code

Find It on Gitee

Find It on GitHub

Java sample code

Click here

Click here

Kotlin sample code

Click here

Click here

NOTE

Before using the sample code, read the README file in the sample project carefully. Run the sample code only after you complete the following operations:

  1. Sign in to AppGallery Connect, download the agconnect-services.json file of your app, and copy the file to the app directory of the sample project.

  2. Open the build.gradle file in the sample project, and change the value of applicationId to your app package name.

Eclipse

If you are using Eclipse, use the Java sample code to implement the functions of signing in with a HUAWEI ID in authorization code or ID token mode and signing out of a HUAWEI ID.

Expand

Sample Code

Find It on Gitee

Find It on GitHub

Java sample code

Click here

Click here

HarmonyOS

If you are using HUAWEI DevEco Studio, use the Java sample code to implement the functions of signing in with a HUAWEI ID in authorization code or ID token mode and signing out of a HUAWEI ID.

Expand

Sample Code

Find It on Gitee

Find It on GitHub

Java sample code

Click here

Click here

JavaScript sample code

Click here

Click here

NOTE

Before using the sample code, read the README file in the demo project carefully. Run the sample code only after you complete the following operations:

  1. Sign in to AppGallery Connect, download the agconnect-services.json file of your app, and copy the file to the entry directory of the demo project.
  2. Open the config.json file in the entry directory, and change the value of bundleName to your app package name.
  3. In the config.json file, you also need to change value in the metaData block to the OAuth 2.0 client ID of your app.
  4. Configure your app signing.

DevEco Studio

If you are using HUAWEI DevEco Studio, use the TypeScript sample code to implement the functions of signing in with a HUAWEI ID in authorization code or ID token mode.

Search in Samples
Enter a keyword.