GenAuth DocsDocuments
Concepts
User Guide
Development Integration
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Concepts
User Guide
Development Integration
Metadata
Development Integration
Multi-tenant (beta)
Console Documentation
Multi-tenant Console
Tenant Console
Saas Application Demo
Old version
User Guide
  • Quick Start

    • Authenticate Your First User

    • Integration Methods for Different Applications

      • Integrate GenAuth with Regular Web Apps
      • Integrate GenAuth with Single Page Apps
      • Integrate GenAuth with Mobile Apps
    • Console Overview
  • Authentication

  • Access Control

  • Authorization

  • Adaptive MFA

  • User Account Management

  • User Directory Management

  • Applications

  • Become a Federation Authentication Identity Provider

  • Connect External Identity Providers (IdP)

  • WeChat Ecosystem Full Scenario Capabilities

  • Migrate Users to GenAuth

  • Security Settings

  • Branding

  • Automation

  • Audit Logs

  • Setting

  • FAQ

  1. User Guide
  2. /
  3. Quick Start

  4. /
  5. Integration Methods for Different Applications

  6. /
  7. Integrate GenAuth with Mobile Apps

¶ Integrate GenAuth in mobile (iOS, Android)

Update time: 2025-04-11 11:21:15
Edit

GenAuth provides Android SDK and iOS SDK to help developers quickly integrate GenAuth in mobile apps.

The following takes the integration method of Android apps as an example.

¶ Installation

  1. Download the jar package and import the jar package into lib

Jar package download address:

  • https://download.genauth.ai/packages/jar/commons-codec-1.15-rep.jar (opens new window)
  • https://download.genauth.ai/packages/jar/core.jar (opens new window)

Import the Jar package into lib, as shown below:

  1. Configure build.gradle
implementation "com.google.code.gson:gson:2.8.6"
implementation "com.squareup.okhttp3:okhttp:4.8.0"
implementation files('libs/core.jar')
implementation files('libs/commons-codec-1.15-rep.jar')
  1. Install GenAuth Java/Kotlin SDK

For detailed installation instructions, please see: GenAuth Java/Kotlin SDK .

¶ Example

¶ Java

  • Initialize AuthenticationClient with the user pool ID.
  • Call AuthenticationClient methods.
// Initialize with AppId and appHost
AuthenticationClient authentication = new AuthenticationClient(APP_ID, APP_HOST);

client.registerByEmail(new RegisterByEmailInput("xxx@qq.com", "123456")).enqueue(new cn.authing.core.http.Callback<cn.authing.core.types.User>() {
    @Override
    public void onSuccess(cn.authing.core.types.User user) {

    }

    @Override
    public void onFailure(@Nullable GraphQLResponse.ErrorInfo errorInfo) {

    }
});

¶ Kotlin

  • Initialize AuthenticationClient with user pool ID.
  • Call AuthenticationClient method.
val authenticationClient = AuthenticationClient("YOUR_USERPOOL_ID")

authenticationClient.registerByEmail(
    RegisterByEmailInput(
        "xxx@.qq.com",
        "123456"
    )
).enqueue(object : cn.authing.core.http.Callback<User> {
    override fun onFailure(error: ErrorInfo?) {

    }

    override fun onSuccess(result: User) {

    }
})

¶ User registration and login

GenAuth Java SDK supports multiple registration and login methods such as mobile phone number verification code, email, and user name. Take mobile phone number verification code login as an example:

  1. Send verification code
String phone = "phone number";
authenticationClient.sendSmsCode(phone).execute();
  1. Login using verification code
String phone = "phone number";
String code = "1234";
User user = authenticationClient.loginByPhoneCode(new LoginByPhoneCodeInput(phone, code)).execute();

For detailed documentation, please see: User Registration and Login API .

¶ Integrate WeChat login

You can use the loginByWechat method of AuthenticationClient. The four required parameters are all parameters returned by WeChat:

Field nameRequiredTypeDescription
codeREQUIREDstringThe code returned by WeChat to APP
countryOPTIONALstringThe country returned by WeChat to APP
langOPTIONALstringThe lang returned by WeChat to APP
stateOPTIONALstringThe state returned by WeChat to APP
val authenticationClient = AuthenticationClient("YOUR_USERPOOL_ID")

val code = "#returned code from wechat#";

authenticationClient.loginByWechat(code).enqueue(object: cn.authing.core.http.Callback<User> {
    override fun onFailure(error: ErrorInfo?) {

    }

    override fun onSuccess(result: User) {
        val user = result
    }
})

¶ Get help

Please visit the GenAuth forum (opens new window).

Previous article: Integrate GenAuth with Single Page Apps Next article: Console Overview
  • Installation
  • Example
  • User registration and login
  • Integrate WeChat login
  • Get help

User identity management

Integrated third-party login
Customized authentication process

Enterprise internal management

Single sign-on
Multi-factor authentication
Permission management

Developer

Development Documentation
GitHub (opens new window)

Company

official@genauth.ai
16th Floor, Building B, Beichen Century Center, Chaoyang District, Beijing (Total)
Room 406, 4th Floor, Block B, No. 200, Tianfu Fifth Street, High-tech Zone, Chengdu (Branch)

© Beijing Steamory Technology Co., Ltd.